Mobile Cloud Computing
Satish [email protected]
MTAT.03.262 - Mobile Application Development – Lecture 7
Outline
• Cloud Computing
• Mobile Cloud
– Binding Models
• HomeAssignment3
10/21/2016 Satish Srirama 2/43
WHAT IS CLOUD COMPUTING?
No consistent answer!
Everyone thinks it is something else…
“It’s nothing new”“...we’ve redefined Cloud Computing to include everything that we already do... I don’t understand what we would do differently ... other than change the wording of some of our ads.”
Larry Ellison, CEO, Oracle (Wall Street Journal, Sept. 26, 2008)
“It’s a trap”“It’s worse than stupidity: it’s marketing hype. Somebody is saying this is inevitable—and whenever you hear that, it’s very likely to be a set of businesses campaigning to make it true.”
Richard Stallman, Founder, Free Software Foundation (The Guardian, Sept. 29, 2008)
Slide taken from Professor Anthony D. Joseph’s lecture at RWTH Aachen10/21/2016 Satish Srirama 3
What is Cloud Computing?
• Computing as a utility
– Utility services e.g. water, electricity, gas etc
– Consumers pay based on their usage
10/21/2016 Satish Srirama 4/43
Clouds - Why Now (not then)?
• Experience with very large datacenters
– Unprecedented economies of scale
– Transfer of risk
• Technology factors
– Pervasive broadband Internet
– Maturity in Virtualization Technology
• Business factors
– Minimal capital expenditure
– Pay-as-you-go billing model
10/21/2016 Satish Srirama 6/43
• Virtualization techniques are the basis of the cloud computing
• Virtualization technologies partition hardware and thus provide flexible and scalable computing platforms
• Virtual machine techniques
– VMware and Xen
– OpenNebula
– Amazon EC2
Virtualization
Hardware
OS
App App App
Hypervisor
OS OS
Virtualized Stack
10/21/2016 Satish Srirama 7/43
Cloud Computing - Characteristics
• Illusion of infinite resources
• No up-front cost
• Fine-grained billing (e.g. hourly)
• Gartner: “Cloud computing is a style of
computing where massively scalable IT-related
capabilities are provided ‘as a service’ across
the Internet to multiple external customers”
10/21/2016 Satish Srirama 8/43
Cloud Computing - Services• Software as a Service – SaaS
– A way to access applications hosted on the web through your web browser
• Platform as a Service – PaaS
– Provides a computing platform and a solution stack (e.g. LAMP) as a service
• Infrastructure as a Service –IaaS
– Use of commodity computers, distributed across Internet, to perform parallel processing, distributed storage, indexing and mining of data
– Virtualization
SaaS
Facebook, Flikr, Myspace.com,
Google maps API, Gmail
PaaS
Google App Engine, Force.com, Hadoop, Azure,
Heroku, etc
IaaS
Amazon EC2, Rackspace, GoGrid, SciCloud, etc.
Level of
Abstraction
10/21/2016 Satish Srirama 9/43
Cloud Computing - Themes
• Massively scalable
• On-demand & dynamic
• Only use what you need - Elastic – No upfront commitments, use on short term basis
• Accessible via Internet, location independent
• Transparent – Complexity concealed from users, virtualized,
abstracted
• Service oriented – Easy to use SLAs
SLA – Service Level Agreement
10/21/2016 Satish Srirama 10/43
Cloud Models
• Internal (private) cloud– Cloud with in an organization
• Community cloud– Cloud infrastructure jointly
owned by several organizations
• Public cloud– Cloud infrastructure owned by
an organization, provided to general public as service
• Hybrid cloud– Composition of two or more
cloud models
10/21/2016 Satish Srirama 11/43
Cloud Application Demand
• Many cloud applications have cyclical demand curves– Daily, weekly, monthly, …
• Workload spikes are more frequent and significant– When some event happens like a pop star has expired:
• More # tweets, Wikipedia traffic increases
• 22% of tweets, 20% of Wikipedia traffic when Michael Jackson expired in 2009 – Google thought they are under attack
Demand
Time
Res
ourc
es
10/21/2016 Satish Srirama 12/43
Unused resources
Economics of Cloud Users
• Pay by use instead of provisioning for peak
Static data center Data center in the cloud
Demand
Capacity
Time
Res
ourc
es
Demand
Capacity
Time
Res
ourc
es
10/21/2016 Satish Srirama 13/43
Unused resources
Economics of Cloud Users - continued
• Risk of over-provisioning: underutilization
– Huge sunk cost in infrastructure
Static data center
Demand
Capacity
Time
Res
ourc
es
10/21/2016 Satish Srirama 14/43
Economics of Cloud Users - continued
• Heavy penalty for under-provisioning
Lost revenue
Lost users
Res
ourc
esDemand
Capacity
Time (days)
1 2 3
Res
ourc
es
Demand
Capacity
Time (days)
1 2 3
Res
ourc
es
Demand
Capacity
Time (days)
1 2 3
10/21/2016 Satish Srirama 15/43
Optimal resource provisioning for
auto-scaling enterprise applications• Auto-Scaling
– Scaling policy -> When to Scale
– Resource provisioning policy -> How to scale
• Cloud providers offer various instance types with different processing power and price– Can it be exploited in deciding the resource provisioning policy?
– Makes the policy to be aware of current deployment configuration
• Another challenge: Cloud providers charge the resource usage for fixed time periods– E.g. Hourly prices of Amazon cloud
• Developed an LP based optimization model which considers both the issues [Srirama and Ostovar, CloudCom 2014]
10/21/2016 Satish Srirama 16/43
Scaling enterprise application with the
optimization model
10/21/2016 Satish Srirama
Incoming load and scaling
curves of Optimization model
Instance type usage curves of
Optimization model
Scaling with Amazon
AutoScale
[Srirama and Ostovar, CloudCom 2014]
Basics of Cloud Computing - MTAT.08.027 (Spring 2016)17/43
Short Term Implications of Clouds
• Startups and prototyping
– Minimize infrastructure risk
– Lower cost of entry
• Batch jobs
• One-off tasks
– Washington post, NY Times
• Cost associatively for scientific applications
• Research at scale
10/21/2016 Satish Srirama 18/43
Long Term Implications of clouds
• Application software:
– Cloud & client parts, disconnection tolerance
• Infrastructure software:
– Resource accounting, VM awareness
• Hardware systems:
– Containers, energy proportionality
10/21/2016 Satish Srirama 19/43
Economics of Cloud Providers
• Cloud Computing providers bring a shift from high reliability/availability servers to commodity servers– At least one failure per day in large datacenter
• Why?– Significant economic incentives
• much lower per-server cost
• Caveat: User software has to adapt to failures– Very hard problem!
• Solution: Replicate data and computation– MapReduce & Distributed File System
10/21/2016 Satish Srirama
Basics of Cloud Computing - MTAT.08.027 (Spring 2017)[Srirama et al, FGCS 2012]20/43
Mobile Cloud Computing
• One can do interesting things on mobiles directly
– Today’s mobiles are far more capable
– We can even provide services from smart phones[Srirama et al, ICIW 2006; Srirama and Paniagua, MS 2013; Chang et al, ICSOC 2012; Liyanage et al, MS 2015]
• However, some applications need to offload certain activities to servers
– Processing sensor data
• Resource-intensive processing on the cloud
– To enrich the functionality of mobile applications
10/21/2016 Satish Srirama 22/43
Mobile Cloud Applications
• Bring the cloud infrastructure to the proximity
of the mobile user
• Mobile has significant advantage by going
cloud-aware
– Increased data storage capacity
– Availability of unlimited processing power
– PC-like functionality for mobile applications
– Extended battery life (energy efficiency)
10/21/2016 Satish Srirama 23/43
Demo
• Demonstrate the trade-off of using Mobile
Cloud
– Image processing application
10/21/2016 Satish Srirama 24/43
Mobile cloud - Binding models
Delegation Code Offloading
MCM
[Flores and Srirama, JSS 2014] [Flores et al, IEEE Communications Mag 2015]
10/21/2016 Satish Srirama 25/43
Mobile Cloud mash-up applications
• Mobiles may have to take advantage of multiple clouds
• Follows traditional SOA model to invoke services
• Typical scenarios – Process intensive services
• Face recognition, sensor mining etc.
– Data Synchronization (SyncML, Funambol, Google Sync)• Calendar, contacts etc.
• Critical challenges – Cloud interoperability is a huge trouble
– Mobiles need to possess multiple APIs
– Unavailability of standards and mobile platform specific API
10/21/2016 Satish Srirama 26/43
Mobile Cloud Middleware
[Flores et al, MoMM 2011; Flores and Srirama, JSS 2014]
[Srirama and Paniagua, MS 2013]
10/21/2016
[Warren et al, IEEE PC 2014]
Satish Srirama
Google Cloud
Messaging
Microsoft Push
Notification
Service
27/43
MCM – enables
• Interoperability between different Cloud Services (IaaS, SaaS, PaaS) and Providers (Amazon, Eucalyptus, etc)
• Provides an abstraction layer on top of API
• Composition of different Cloud Services
• Asynchronous communication between the device and MCM
• Means to parallelize the tasks and take advantage of Cloud’s intrinsic characteristics
10/21/2016 Satish Srirama 28/43
CroudSTag – Scenario
• CroudSTag takes the pictures/videos from the cloud and tries to recognize people
– Pictures/Videos are actually taken by the phone
– Processes the videos
– Recognizes people using facial recognition technologies
• Reports the user a list of people recognized in the pictures
• The user decides whether to add them or not to the social group
• The people selected by the user receive a message in facebook inviting them to join the social group
10/21/2016 Satish Srirama 29/43
CroudSTag [Srirama et al, PCS 2011;
SOCA 2012]
• Cloud services used
– Media storage on
Amazon S3
– Processing videos on
Elastic MapReduce
– face.com to recognize
people on facebook
– Starting social group
on facebook
10/21/2016 Satish Srirama 30/43
Other applications
• Zompopo [Srirama et al, NGMAST 2011]
– Intelligent calendar, by mining accelerometer sensor data
• Bakabs [Paniagua et al, iiWAS-2011]
– Managing the Cloud resources from mobile
• Sensor data analysis– Human activity recognition
– Context aware gaming
– MapReduce based sensor data analysis [Paniagua et al, MobiWIS2012]
• SPiCa: A Social Private Cloud Computing Application Framework [Chang et al, MUM 2014]
10/21/2016 Satish Srirama 31/43
Checking for updates
• Polling
• Polling consumes lot of battery of mobile
• Heavy load on the resources of the server
• Strains the network
10/21/2016 Satish Srirama
Any new updates ?
No
Any new updates ?
No
Any new updates ?
YES
32/43
Google Cloud Messaging
• Free service that allows you to send data from
your servers to your users and vice versa
• Handles queuing of messages and delivery to
the target application
– Application does not need to be running in the background for receiving data messages
– The system will wake up the Android application
via Intent broadcast when the message arrives
10/21/2016 Satish Srirama 33/43
Working with GCM
10/21/2016 Satish Srirama
Mobile App
GCM
1.Request for Registration
2.Reply with Registration Id
5. Send Message
3.Send Registration Id 4. Send message {RegId, msg}
https://developers.google.com/cloud-messaging/
[Warren et al, IEEE PC 2014]
34/43
Firebase Cloud Messaging (FCM)
• GCM is now deprecated and is being replaced
by FCM
• FCM also supports sending messages to
multiple phones, to topics etc.
• FCM also supports sending messages to the
application server from the mobile
– Using the Extensible Messaging and Presence
Protocol (XMPP)
10/21/2016 35/43Satish Srirama
Working with FCM – Course Exercise
• Add Firebase to your app
https://firebase.google.com/docs/android/setup
• If there are problems such as
– failed to resolve compile
'com.google.firebase:firebase-messaging:9.6.1'
– install Google Play Services and Google Repository
in Android Studio, SDK Manager on SDK Tools tab
• Access the device registration token and log it
10/21/2016 36/43Satish Srirama
String token = FirebaseInstanceId.getInstance().getToken();
FCM – Course Exercise - continued
• Create a service that extends FirebaseMessagingService
• Add the following to the manifest file
• Override onMessageReceived(RemoteMessage
remoteMessage) of the service to read the message
10/21/2016 37/43Satish Srirama
<serviceandroid:name=".MyFirebaseMessagingService"><intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/></intent-filter>
</service>
FCM – Course Exercise - continued
• Sending a notification message
– Install and run the app on the target device
– Open the Notifications tab of the Firebase console
and select New Message
– Enter the message text
– Select Single Device for the message target
– In the field labelled FCM Registration Token, enter
the registration token you obtained
– Click send message
10/21/2016 38/43Satish Srirama
Code Offloading
• Also known as Cyber-foraging [M. Satyanarayanan, 2001]
• Not a completely new topic
– Can be realized similar to RMI, RPC etc.
• Devices offload some of their heavy work to
stronger surrogate machines in the vicinity
(Cloudlets)
10/21/2016 Satish Srirama 39/43
Major Components
• Mobile
– Code profiler
– System profilers
– Decision engine
• Cloud based surrogate platform
10/21/2016 Satish Srirama 40/43
Some of the well known frameworks
• MAUI
– Manual annotations [Cuervo et al., 2010]
• CloneCloud
– Code profilers & Automated process [Chun et al.,
2011]
• ThinkAir
– Manual annotations and scalability [Kosta et al, 2012]
• EMCO [Flores and Srirama, MCS 2013] & etc.
10/21/2016 Satish Srirama 41/43
Code offloading – Major challenges
• Work in controlled environments like nearby
servers
– However, none can be adapted for real life
applications
• Major research challenges
– What, when, where and how to offload?
10/21/2016 Satish Srirama
[Flores et al, IEEE Communications Mag 2015]
42/43
Practical adaptability of offloading
Applications that can benefit became limited with increase in device capacities10/21/2016 Satish Srirama 43/43
Home Assignment - 3
• Image processing on the cloud
• Being able to repeat the task demonstrated in
the lecture
• Deadline – 4th November 2016
• Last deadline for all submissions – 11th
November 2016
10/21/2016 Satish Srirama 44/43
References• S. N. Srirama, A. Ostovar: Optimal Resource Provisioning for Scaling Enterprise Applications on the Cloud, The 6th IEEE International Conference on
Cloud Computing Technology and Science (CloudCom-2014), December 15-18, 2014, pp. 262-271. IEEE.
• S. N. Srirama, P. Jakovits, E. Vainikko: Adapting Scientific Computing Problems to Clouds using MapReduce, Future Generation Computer Systems Journal, 28(1):184-192, 2012. Elsevier press. DOI 10.1016/j.future.2011.05.025.
• S. N. Srirama, M. Jarke, W. Prinz: Mobile Web Service Provisioning, Proceedings of the Advanced International Conference on Telecommunications and International Conference on Internet and Web Applications and Services (AICT-ICIW 2006), February 23-25, 2006, pp. 120-125. IEEE CS Press.
• S. N. Srirama, C. Paniagua: Mobile Web Service Provisioning and Discovery in Android Days, The 2013 IEEE International Conference on Mobile Services (MS 2013), June 27 - July 02, 2013, pp. 15-22. IEEE.
• C. Chang, S. N. Srirama, S. Ling: An Adaptive Mediation Framework for Mobile P2P Social Content Sharing, 10th International Conference on Service Oriented Computing (ICSOC 2012), November 12-16, 2012, pp. 374-388. Springer LNCS.
• M. Liyanage, C. Chang, S. N. Srirama: Lightweight Mobile Web Service Provisioning for Sensor Mediation, 4th International Conference on Mobile Services (MS 2015), June 27 - July 2, 2015, pp. 57-64. IEEE.
• H. Flores, S. N. Srirama: Mobile Cloud Middleware, Journal of Systems and Software, ISSN: 0164-1212, 92(1):82-94, 2014. Elsevier. DOI: 10.1016/j.jss.2013.09.012.
• H. Flores, P. Hui, S. Tarkoma, Y. Li, S. N. Srirama, R. Buyya: Mobile Code Offloading: From Concept to Practice and Beyond, IEEE Communications Magazine, ISSN: 0163-6804, 53(3):80-88, 2015. IEEE. DOI:10.1109/MCOM.2015.7060486
• I. Warren, A. Meads, S. N. Srirama, T. Weerasinghe, C. Paniagua: Push Notification Mechanisms for Pervasive Smartphone Applications, IEEE Pervasive Computing, ISSN: 1536-1268, 13(2):61-71, 2014. IEEE. DOI:10.1109/MPRV.2014.34.
• H. Flores, S. N. Srirama, C. Paniagua: A Generic Middleware Framework for Handling Process Intensive Hybrid Cloud Services from Mobiles, The 9th International Conference on Advances in Mobile Computing & Multimedia (MoMM-2011), December 5-7, 2011, pp. 87-95. ACM.
• S. N. Srirama, C. Paniagua, H. Flores: CroudSTag: Social Group Formation with Facial Recognition and Mobile Cloud Services, The 8th International Conference on Mobile Web Information Systems (MobiWIS 2011), September 19-21, 2011, v. 5 of Procedia Computer Science, pp. 633-640. Elsevier.
• S. N. Srirama, C. Paniagua, H. Flores: Social Group Formation with Mobile Cloud Services, Service Oriented Computing and Applications Journal, ISSN: 1863-2386, 6(4):351-362, 2012. Springer. DOI: 10.1007/s11761-012-0111-5.
• S. N. Srirama, H. Flores, C. Paniagua: Zompopo: Mobile Calendar Prediction based on Human Activities Recognition using the Accelerometer and Cloud Services, 5th Int. Conf. on Next Generation Mobile Applications, Services and Technologies (NGMAST 2011), Sep. 14-16, 2011, pp. 63-69. IEEE.
• Cuervo, Eduardo, et al. "MAUI: making smartphones last longer with code offload." Proceedings of the 8th international conference on Mobile systems, applications, and services. ACM, 2010.
• Kosta, Sokol, et al. "Thinkair: Dynamic resource allocation and parallel execution in the cloud for mobile code offloading." INFOCOM, 2012 Proceedings IEEE. IEEE, 2012.
• Satyanarayanan, Mahadev, et al. "The case for vm-based cloudlets in mobile computing." Pervasive Computing, IEEE 8.4 (2009): 14-23.
• H. Flores, S. N. Srirama: Adaptive Code Offloading for Mobile Cloud Applications: Exploiting Fuzzy Sets and Evidence-based Learning, The Fourth ACM Workshop on Mobile Cloud Computing and Services (MCS 2013) @ The 11th International Conference on Mobile Systems, Applications and Services (MobiSys 2013), June 25-28, 2013, pp. 9-16. ACM.
10/21/2016 Satish Srirama 45/43