Mobile Cloud Computing · (e.g. neuromorphic) architectures • Approximate computing: performance,...

Preview:

Citation preview

Mobile Cloud Computing

Satish Sriramasatish.srirama@ut.ee

MTAT.03.262 - Mobile Application Development – Lecture 8

Outline

• Cloud Computing

• Mobile Cloud

– Binding Models

• HomeAssignment3

02/11/2018 Satish Srirama 2/53

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 Aachen02/11/2018 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

02/11/2018 Satish Srirama 4/53

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

02/11/2018 Satish Srirama 5/53

• 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

• Recent updates - containers

Virtualization

Hardware

OS

App App App

Hypervisor

OS OS

Virtualized Stack

02/11/2018 Satish Srirama 6/53

Containers

• Use kernel of the host operating system instead of a hypervisor– Linux namespace

• Lightweight– No hypervisor overhead

– Each Container acquires only required resources

• Fast start-up/ Bootup– Starting a container is faster than booting new OS or spinning up a

new VM

• Performance– Near native performance

• Different container frameworks– LXC, Docker, Linux VServer, OpenVZ

– Docker is an Open platform [https://www.docker.com/]

02/11/2018 Satish Srirama 7/53

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”

02/11/2018 Satish Srirama 8/53

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

02/11/2018 Satish Srirama 9/53

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

02/11/2018 Satish Srirama 10/53

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

02/11/2018 Satish Srirama 11/53

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

02/11/2018 Satish Srirama 12/53

Unused resources

Economics of Cloud Users

• Many cloud applications have cyclical demand curves– Daily, weekly, monthly, …

• 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

02/11/2018 Satish Srirama 13/53

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

02/11/2018 Satish Srirama 14/53

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

02/11/2018 Satish Srirama 15/53

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]

02/11/2018 Satish Srirama 16/53

Scaling enterprise application with the

optimization model

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 2019)02/11/2018 Satish Srirama 17/53

Long Term Implications of clouds

• Application software:

– Cloud & client parts, disconnection tolerance

• Infrastructure software:

– Resource accounting, VM awareness

• Hardware systems:

– Containers, energy proportionality

02/11/2018 Satish Srirama 18/53

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

Basics of Cloud Computing - MTAT.08.027 (Spring 2019)[Srirama et al, FGCS 2012]02/11/2018 Satish Srirama 19/53

Cloud Computing Progress

Armando Fox, 2010

02/11/2018 Satish Srirama 20/53

Directions

for Future

Generation

Cloud

Computing

• Virtualizing GPUs, and non-traditional

(e.g. neuromorphic) architectures

• Approximate computing: performance,

cost, and accuracy trade-offs

• Programming abstractions, models, and

languages for scalable elastic computing

• Decentralised scalable

distributed algorithms

for edge, hybrid, inter

Clouds

• Multi-tenancy in mobile cloud

• Incentive models for Mobile Clouds

and independent Fog providers

• Containers in Fog/Edge computing

• QoS aware application deployment

on Fog nodes

• Edge analytics for real-time stream

data processing

•C

on

tin

uo

us

de

live

ry f

or

Ed

ge

, B

ig

da

ta,

an

d s

erv

erl

ess

co

mp

uti

ng

•M

ult

i-p

ara

dig

m a

nd

clo

ud

-na

tive

de

sig

n p

att

ern

s

•It

era

tive

Clo

ud

ap

plica

tio

n

en

ha

nce

me

nt

A Manifesto for Future Generation Cloud

Computing: Research Directions for the

Next Decade

[Buyya and Srirama et al,

ACM CSUR 2018]

02/11/2018 21/53

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

Already have checked in lecture 6

• However, some applications need to offload

certain activities to external servers

– Processing sensor data

• Resource-intensive processing on the cloud

– To enrich the functionality of mobile applications

02/11/2018 Satish Srirama 22/53

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)

02/11/2018 Satish Srirama 23/53

Demo

• Demonstrate the trade-off of using Mobile

Cloud

– Image processing application

02/11/2018 Satish Srirama 24/53

Hybrid/heterogeneous Mobile Cloud

[Zhou et al, TSC 2017]02/11/2018 25/53

Mobile cloud - Binding models

Task Delegation Code Offloading

MCM

[Flores and Srirama, JSS 2014] [Flores et al, IEEE Communications Mag 2015]

02/11/2018 Satish Srirama 26/53

Task Delegation: Mobile Cloud mash-

up applications

• Mobiles may have to take advantage of multiple clouds

• Follows traditional SOA (Service Oriented Architecture) model to invoke services

• Typical scenarios

– Process intensive services

• Face recognition, sensor mining etc.

• Critical challenges

– Cloud interoperability is a huge trouble

– Mobiles need to possess multiple APIs

– Unavailability of standards and mobile platform specific API

02/11/2018 Satish Srirama 27/53

Mobile Cloud Middleware

[Flores et al, MoMM 2011; Flores and Srirama, JSS 2014]

[Srirama and Paniagua, MS 2013]

[Warren et al, IEEE PC 2014]

Google Cloud

Messaging

Microsoft Push

Notification

Service

02/11/2018 Satish Srirama 28/53

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

02/11/2018 Satish Srirama 29/53

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

02/11/2018 Satish Srirama 30/53

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

02/11/2018 Satish Srirama 31/53

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,

MobiWIS 2012]

02/11/2018 Satish Srirama 32/53

Checking for updates

• Polling

• Polling consumes lot of battery of mobile

• Heavy load on the resources of the server

• Strains the network

Any new updates ?

No

Any new updates ?

No

Any new updates ?

YES

02/11/2018 Satish Srirama 33/53

Firebase Cloud Messaging

• Free service that allows you to send data from your servers to your users and vice versa

• FCM replaced Google Cloud Messaging (GCM)– GCM is now deprecated

• Firebase by platform– Goes beyond just messaging

– Firebase provides the tools to develop high-quality apps, grow your user base, and earn more money

– Provides services for Authentication, Realtime Database, Performance Monitoring, Cloud Storage, Analytics, AdWords etc.

– https://firebase.google.com/docs/

02/11/2018 Satish Srirama 34/53

Firebase Cloud Messaging (FCM) -

continued• A cross-platform messaging solution

– Can now send messages to Android, iOS, etc.

• 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

• FCM also supports sending messages to multiple phones, to devices subscribed to topics etc.

• FCM also supports sending messages to the application server from the mobile– Using the Extensible Messaging and Presence Protocol (XMPP)

02/11/2018 Satish Srirama 35/53

Types of messages

• Notification messages– Handled by the FCM SDK automatically

– Have a predefined set of user-visible keys

– Optional data payload of custom key-value pairs

– When App is in the background, • Apps receive the notification payload in the notification tray

• Apps only handle the data payload when the user taps on the notification

– When App is in the foreground, • App receives a message object with both payloads available

• Data messages– Handled by the client app

– Data messages have only custom key-value pairs

02/11/2018 Satish Srirama 36/53

Working with FCM – with

RegistrationID

Mobile App

FCM

1.Request for Registration

2.Reply with Registration Id

5. Send Message

3.Send Registration Id 4. Send message {RegId, msg}

https://firebase.google.com/docs/cloud-messaging/

02/11/2018 Satish Srirama 37/53

Working with FCM – Course Exercise

• Add Firebase to your app

https://firebase.google.com/docs/android/setup– ensure classpath is 'com.google.gms:google-services:4.2.0‘

• ## add to root-level build.gradle:dependencies {

...

classpath 'com.google.gms:google-services:4.2.0' // [J] google-services plugin

...

}

• ## add to module-level build.gradle:dependencies {

...

implementation 'com.google.firebase:firebase-messaging:17.3.4'

}

– # Put at end of file:apply plugin: 'com.google.gms.google-services‘

• If there are problems such as– failed to resolve compile 'com.google.firebase:firebase-messaging:17.3.4'

– install Google Play Services and Google Repository in Android Studio, SDK Manager on SDK Tools tab

02/11/2018 Satish Srirama 38/53

FCM – Course Exercise - continued

• Access the device registration token and log it

02/11/2018 Satish Srirama 39/53

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

<serviceandroid:name=".MyFirebaseMessagingService"><intent-filter>

<action android:name="com.google.firebase.MESSAGING_EVENT"/></intent-filter>

</service>

40/53

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

02/11/2018 Satish Srirama 41/53

Working with FCM – Subscribe to a

topic

Mobile App

FCM

1. Subscribe to a topic

2. Confirmation

4. Send Message

3. Send message {topic, msg}

https://firebase.google.com/docs/cloud-messaging/

02/11/2018 Satish Srirama 42/53

FCM to topic – Course Exercise 2

• For sending to a topic

– Let application subscribe to a topic

– On firebase console send message to a topic

02/11/2018 Satish Srirama 43/53

Mobile cloud - Binding models

Task Delegation Code Offloading

MCM

[Flores and Srirama, JSS 2014] [Flores et al, IEEE Communications Mag 2015]

02/11/2018 Satish Srirama 44/53

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)

02/11/2018 Satish Srirama 45/53

Major Components

• Mobile

– Code profiler

– System profilers

– Decision engine

• Cloud based surrogate platform

02/11/2018 Satish Srirama 46/53

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.

02/11/2018 Satish Srirama 47/53

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?

[Flores et al, IEEE Communications Mag 2015]

02/11/2018 Satish Srirama 48/53

Practical adaptability of offloading

Applications that can benefit became limited with increase in device capacities

[Srirama, CSIICT 2017]

49/53

Conclusion

• Cloud computing offers interesting

opportunities in different domains

• Mobile applications benefit a lot by pushing

some of the resource intensive tasks to cloud

• Checked two binding models

– Task Delegation

– Code offloading

02/11/2018 Satish Srirama 50/53

What have we learnt?

• You can develop Android applications

• Sensors and Internet of Things

• Providing sensor information from smart phones

• Location based services

• Testing android applications

• Multi-platform mobile application development

• Mobile Cloud

02/11/2018 Satish Srirama 51/53

Home Assignment - 3

• Image processing on the cloud

• Being able to repeat the task demonstrated in

the lecture

• Deadline – 16th November 2018

• Last deadline for all submissions – 23rd

November 2018

02/11/2018 Satish Srirama 52/53

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.

• Rajkumar Buyya, Satish Narayana Srirama, Giuliano Casale, et al, : A Manifesto for Future Generation Cloud Computing: Research Directions for the Next Decade, ACM Computing Surveys, ISSN 0360-0300, 2018. ACM Press, New York, USA.

• B. Zhou, A. V. Dastjerdi, R. N. Calheiros, S. N. Srirama, R. Buyya: mCloud: A Context-aware Offloading Framework for Heterogeneous Mobile Cloud, IEEE Transactions on Services Computing, ISSN: 1939-1374, 10(5):797-810, 2017. IEEE. DOI: 10.1109/TSC.2015.2511002

• 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.

• S. N. Srirama: Mobile Web and Cloud Services Enabling Internet of Things, Special Issue ICAC 2016 of CSIT, CSI Transactions on ICT, ISSN: 2277-9078, 5(1):109-117, 2017. Springer. DOI: 10.1007/s40012-016-0139-3

02/11/2018 Satish Srirama 53/53

Recommended