instructor: li erran li ( [email protected] ) ~lierranli/coms6998-10spring2013/ 4 / 2 /2013:...

88
Instructor: Li Erran Li ([email protected]) http://www.cs.columbia.edu/ ~lierranli/coms6998-10Spring20 13/ 4/2/2013: Mobile Cloud Computing 1 Cellular Networks and Mobile Computing COMS 6998-10, Spring 2013

Upload: irish

Post on 26-Feb-2016

38 views

Category:

Documents


2 download

DESCRIPTION

Cellular Networks and Mobile Computing COMS 6998-10, Spring 2013. Instructor: Li Erran Li ( [email protected] ) http://www.cs.columbia.edu/ ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing. Review of Previous Lecture. Push notification service Track service. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

1

Instructor: Li Erran Li ([email protected])

http://www.cs.columbia.edu/~lierranli/coms6998-10Spring2013/4/2/2013: Mobile Cloud Computing

Cellular Networks and Mobile ComputingCOMS 6998-10, Spring 2013

Page 2: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

2

Review of Previous Lecture

• Push notification service• Track service

4/2/13

Page 3: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

3

Review of Previous Lecture (Cont’d)

• What is the difference between APNS, GCM and Thialfi?

4/2/13

Page 4: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

4

Review of Previous Lecture (Cont’d)

• Push notification service– Unreliable: APNS, GCM– Reliable: Thialfi (has a notion of objects)

4/2/13

Page 5: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

5

Thialfi Architecture

ClientBigtable

• Matcher: Object ID registered clients, version• Registrar: Client ID registered objects, notifications

Client

Registrar

MatcherObjectBigtable

Data center

Notifications Application Backend

Registrations, notifications,acknowledgments

Client library

4/2/13 Courtesy: Adya et al.

• Each server handles a contiguous range of keys, • Each server maintains an in-memory version• Bigtable: log structured, fast write

Page 6: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

6

C1: x, v7C2: x, v7C1: x, v5C2: x,

x: v5; C1, C2x: v7; C1, C2x: v7; C1, C2

x

Thialfi: Life of a Notification

ClientBigtable

C1: x, v7

C2: x, v7

Notify: x, v7

Client C2

MatcherObjectBigtable

Data center

Publish(x, v7)x, v7

Ack: x, v7

Registrar

4/2/13 Courtesy: Adya et al.

Page 7: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

7

Review of Previous Lecture (Cont’d)

• How to classify location based services?

4/2/13

Page 8: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

8

A Taxonomy of ApplicationsPersonal Social

Current location

Driving directions, Nearby restaurants

Friend finder, Crowd scenes

Past locations

Personal travel journal, Geocoded photos

Post-it notes, Recommendations

Tracks Personalized Driving Directions, Track-Based Search

Ride sharing, Discovery, Urban sensing

Class of applications enabled by StarTrack

4/2/13 Courtesy: Maya et al.

Page 10: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

10

What are System Challenges of Track Service?

1. Handling error-prone tracks

2. Flexible programming interface

3. Efficient implementation of operations on tracks

4. Scalability and fault tolerance4/2/13 Courtesy: Maya et al.

Page 11: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

11

Challenges of Using Raw Tracks

Advantages of Canonicalization:– More efficient retrieval and comparison operations– Enables StarTrack to maintain a list of non-duplicate tracks

4/2/13 Courtesy: Maya et al.

Page 12: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

12

StarTrack API

Track Collections (TC): Abstract grouping of tracks– Programming Convenience– Implementation Efficiency

• Prevent unnecessary client-server message exchanges− Enable delayed evaluation− Enable caching and use of in-memory data structures

Pre-filter tracks Manipulate tracks Fetch tracks

4/2/13 Courtesy: Maya et al.

Page 13: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

13

StarTrack API: Track Collections

TC JoinTrackCollections (TC tCs[], bool removeDuplicates) TC SortTracks (TC tC, SortAttribute attr) TC TakeTracks(TC tC, int count) TC GetSimilarTracks (TC tC, Track refTrack, float simThreshold) TC GetPassByTracks (TC tC, Area[] areas) TC GetCommonSegments(TC tC, float freqThreshold)

Track[] GetTracks (TC tC, int start, int count)

Manipulation

Retrieval

Creation TC MakeCollection(GroupCriteria criteria, bool removeDuplicates)

4/2/13 Courtesy: Maya et al.

Page 14: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

14

API Usage: Ride-Sharing Application// get user’s most popular track in the morning

TC myTC = MakeCollection(“name = Maya”, [0800 1000], true);TC myPopTC = SortTracks(myTC, FREQ);Track track = GetTracks(myPopTC, 0, 1);

// find tracks of all fellow employeesTC msTC = MakeCollection(“name.Employer = MS”, [0800 1000], true);

// pick tracks from the community most similar to user’s popular trackTC similarTC = GetSimilarTracks(msTC, track, 0.8);Track[] similarTracks = GetTracks(similarTC, 0, 20);

// Verify if each track is frequently traveled by its respective ownerUser[] result = FindOwnersOfFrequentTracks(similarTracks);

4/2/13 Courtesy: Maya et al.

Page 15: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

15

Outline

• Mobile cloud platform services (previous lecture)• Existing programming model for code offloading

– MAUI (Nishtha Agarwal and Shuo Qiu) – Odessa (Junyang Lu and Xiaoji Li)– CloneCloud– COMET: code offloading using distributed shared memory

• Advancing the state of mobile cloud computing (Deepika Tunikoju and Rashmi Prithyani)

3/26/13

Page 16: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Mobile Cloud Computing (mCloud) today

• Apple iCloud– Store content in cloud and

sync to all registered devices

– Hosted by Windows Azure and Amazon AWS

– iCloud Storage APIs support third-party app document syncing

16Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 17: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Mobile Cloud Computing today (Cont’d)

• Amazon Silk browser– Accelerates web access– Learns user behavior and

precache– Intelligently partition work

between local and Amazon cloud

17Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 18: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Fundamental Challenges

• What architecture best supports mCloud?• What programming model best enables client

to tap mCloud resources?• What are basic services or building blocks for

mCloud?• What best supports service interaction?

18Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 19: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Architecture• Resource-intensive mobile

applications– Face recognition for social

networking app– Gesture recognition for control

media app – Object and post recognition for

augmented reality app• End-to-end latency and througput

matters for crisp interaction– Augmented reality need to display

results within 1 sec– Need high data rate processing

capability, low frame rate can miss gesture

19

Delay, loss on frame rate of video stream transfer [Odessa, 2011]

Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 20: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Architecture (Cont’d)• WAN performance

– First hop latency in 3G is 200ms– Verizon LTE :128ms, 6.44 Mbps

downlink, 5Mbps uplink [Pcworld, March 2011]

• There is a need for a middle tier

• cloudlet = (compute cluster+ wireless access point+ wired Internet access+ no battery limitations)

• “data center in a box”20

“Anatomizing Application Performance Differences on Smartphones”, MobiSys 2010 (Huang et al)

Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 21: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Architecture (Cont’d)

• Cloudlet possible locations• Cellular providers has a unique advantage

21

BS

Wireless Core

Internet

WiFi AP

RDCA1

RDCA2

RDCB1

RDCB2

Regional Data centers (RDC)

RNC

Storage nodes

Computenodes

Possible locationsof cloudlet

Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 22: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Programming Model• MAUI: RPC based offloading architecture• CloneCloud: tight synchronization between cloud and

phone• Odessa: data-flow graph to exploit parallelism in

perception applications• COMET: distributed shared memory• MAUI, CloneCloud , Odessa all have profiler, solver

22

MAUI CloneCloud Odessa COMET

Remote execution unit

Methods (RMI)

Threads (method entry/exit)

Tasks Threads (any place)

Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 23: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Programming Model: MAUI

• Combine extensive profiling with an ILP solver– Makes dynamic offload decisions– Optimize for energy reduction– Profile: device, network, application

• Leverage modern language runtime (.NET CLR)– Portability:

• Mobile (ARM) vs Server (x86)• .NET Framework Common Intermediate Language

– Type-Safety and Serialization: • Automate state extraction

– Reflection: • Identifies methods with [Remoteable] tag• Automates generation of RPC stubs

23Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 24: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Maui serverSmartphone

Application

Client Proxy

Profiler

Solver

Maui Runtime

Server Proxy

Profiler

Solver

Maui Runtime

Application

RPC

RPC

Maui Controller

mCloud Programming Model: MAUI (Cont’d)

Intercepts Application CallsSynchronizes State

Chooses local or remote

Handles Errors

Provides runtime information

• MAUI architecture

Cellular Networks and Mobile Computing (COMS 6998-10) 24Source: MAUI Mobisys presentation4/2/13

Page 25: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

MAUI Profiler

ProfilerCallgraph

Execution Time

State size

Network Latency

Network Bandwidth

Device ProfileCPU Cycles

Network Power CostNetwork DelayComputational Delay

Computational Power CostComputational Delay

Annotated Callgraph

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 254/2/13

Page 26: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

MAUI Solver

B900 mJ15ms

C5000 mJ3000 ms

1000mJ25000 m

J D15000 mJ12000 ms

1000

0 m

J

A

Computation energy and delay for execution

Energy and delay for state transfer

A sample callgraph

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10)264/2/13

Page 27: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Is Global Program Analysis Needed?

FindMatch900 mJ

InitializeFaceRecognizer

5000 mJ

1000mJ25000 m

J DetectAndExtract Faces

15000 mJ

1000

0 m

J

UserInterface

Yes! – This simple example from Face Recognition app shows why local analysis fails.

Cheaper to do local

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 274/2/13

Page 28: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Is Global Program Analysis Needed?

FindMatch900 mJ

InitializeFaceRecognizer

5000 mJ

1000mJ25000 m

J DetectAndExtract Faces

15000 mJ

1000

0 m

J

UserInterface

Yes! – This simple example from Face Recognition app shows why local analysis fails.

Cheaper to do local

Cheaper to do local

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 284/2/13

Page 29: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Is Global Program Analysis Needed?

FindMatch

InitializeFaceRecognizer

1000mJ

DetectAndExtract Faces

UserInterface 25900mJ

Cheaper to offload

Source: MAUI Mobisys presentation

Cellular Networks and Mobile Computing (COMS 6998-10)

294/2/13

Page 30: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Can MAUI Adapt to Changing Conditions?

• Adapt to:– Network Bandwidth/Latency Changes– Variability on method’s computational requirements

• Experiment:– Modified off the shelf arcade game application– Physics Modeling (homing missiles)– Evaluated under different latency settings

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 304/2/13

Page 31: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

DoLevel

HandleMissiles

DoFrame

HandleEnemies

HandleBonuses11KB + missiles

11KB

+

miss

iles

missiles

*Missiles take around 60 bytes each

11KB + missiles

Required state is smaller

Complexity increases with # of missiles

Can MAUI Adapt to Changing Conditions?

Source: MAUI Mobisys presentation

Cellular Networks and Mobile Computing (COMS 6998-10)

314/2/13

Page 32: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Case 1

DoLevel

HandleMissiles

DoFrame

HandleEnemies

HandleBonuses

*Missiles take around 60 bytes each

Zero Missiles Low latency (RTT < 10ms)

Computation cost is close to zero

Offload starting at DoLevel

Source: MAUI Mobisys presentation

Cellular Networks and Mobile Computing (COMS 6998-10) 324/2/13

Page 33: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Case 2

DoLevel

HandleMissiles

DoFrame

HandleEnemies

HandleBonuses

*Missiles take around 60 bytes each

5 Missiles Some latency (RTT = 50ms)

Most of the computation cost

Very expensive to offload everything

Little state to offload

Only offload Handle Missiles

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 334/2/13

Page 34: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

MAUI Implementation• Platform

– Windows Mobile 6.5– .NET Framework 3.5– HTC Fuze Smartphone– Monsoon power monitor

• Applications– Chess– Face Recognition– Arcade Game– Voice-based translator

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 344/2/13

Page 35: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Questions

• How much can MAUI reduce energy consumption?• How much can MAUI improve performance?• Can MAUI Run Resource-Intensive Applications?

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 354/2/13

Page 36: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

0

5

10

15

20

25

30

35Smartphone onlyMAUI (Wi-Fi, 10ms RTT)MAUI (Wi-Fi, 25ms RTT)MAUI (Wi-Fi, 50ms RTT)MAUI (Wi-Fi, 100ms RTT)MAUI* (3G, 220ms RTT)

Ener

gy (J

oule

s)

How much can MAUI reduce energy consumption?

Big savings even on 3GAn order of magnitude improvement on Wi-Fi

Face Recognizer

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 364/2/13

Page 37: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

How much can MAUI improve performance?

0

3,000

6,000

9,000

12,000

15,000

18,000

21,000Smartphone onlyMAUI (Wi-Fi, 10ms RTT)MAUI (Wi-Fi, 25ms RTT)MAUI (Wi-Fi, 50ms RTT)MAUI (Wi-Fi, 100ms RTT)MAUI* (3G, 220ms RTT)

Exec

ution

Dur

ation

(ms)

Improvement of around an order of magnitude

Face Recognizer

Source: MAUI presentationCellular Networks and Mobile Computing

(COMS 6998-10) 374/2/13

Page 38: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Latency to server impacts the opportunities for fine-grained offload

0

20

40

60Smartphone onlyMAUI (Wi-Fi, 10ms RTT)MAUI (Wi-Fi, 25ms RTT)MAUI (Wi-Fi, 50ms RTT)MAUI (WiFi, 100ms RTT)MAUI* (3G, 220ms RTT)

Ener

gy (J

oule

s)

Up to 40% energy savings on Wi-Fi

Solver would decide not to offloadArcade Game

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 384/2/13

Page 39: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Can MAUI Run Resource-Intensive Applications?

00:00 00:1700:3400:51 01:0901:26 01:4302:0002:18 02:3502:520

102030405060708090

100

CPU1CPU2

Time

CPU

Con

sum

ption

(%)

CPU Intensive even on a Core 2 Duo PC

Can be run on the phone with MAUI

Translator

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 394/2/13

Page 40: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Conclusions

• MAUI enables developers to:– Bypass the resource limitations of handheld devices– Low barrier entry: simple program annotations

• For a resource-intensive application– MAUI reduced energy consumed by an order of magnitude– MAUI improved application performance similarly

• MAUI adapts to:– Changing network conditions – Changing applications CPU demands

Source: MAUI Mobisys presentationCellular Networks and Mobile Computing

(COMS 6998-10) 404/2/13

Page 41: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Programming Model: CloneCloud

• Offloading decision done at beginning of execution

41Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 42: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

The Before-After Picture

PhoneUI W

Phone

Clone

CloudWUI W'

Clone

Clone

Clone

Cellular Networks and Mobile Computing (COMS 6998-10) 42Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 43: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

CloneCloud v1 Architecture

VMMHW

PartitionAnalyzer

OSVirtual HW

Migration

Mobile Device

RuntimeOSHW

Application

App.VM

Man

ager Migration

Clone VM

ProfilerOS

Virtual HW

Application

App.VM

ManagerProfiler

Cellular Networks and Mobile Computing (COMS 6998-10) 43Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 44: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

AppVM Clones

• Virtual machine of entire client device– Android x86 VM natively executed on VMWare in

an x86 machine

• Synchronized file systems

Cellular Networks and Mobile Computing (COMS 6998-10) 44Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 45: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Partitioning

Where to partition code, satisfying any constraints for correctness,

so as to optimize for current conditions

Cellular Networks and Mobile Computing (COMS 6998-10) 45Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 46: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Automatic Partitioning Framework

Partition Analyzer

Applicationbinary

Partitioningconstraints

Static analysis

location-constraints

Profilinginputs

Dynamicprofiling

cost-annotatedexecutions

Optimizationsolver

Optimal partitioning

pointsIdentify valid split points

Construct cost models

Pick best choice for an objective

Cellular Networks and Mobile Computing (COMS 6998-10) 46Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 47: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Partitioning: Static Analysis• Partitioning points

– Restrict to method entry/exit

• Identify “pinned” methods– Identify framework library methods

• Identify mutually dependent native state– Class natives stay together

• Collect static control flow– Who calls whom

Cellular Networks and Mobile Computing (COMS 6998-10) 47Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 48: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Partitioning: Profiling

• Pick k invocations• For each invocation

– Run app on mobile device

– Run app on clone• For each method

– Execution time– Context size entry/exit– Estimate of energy

consumption

a30, 2100

c60, 810

a'11, 1200

main

main'19, 9

5

b50, 5900

a

Cellular Networks and Mobile Computing (COMS 6998-10) 48Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 49: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Partitioning: Intuition

• Partitioning points splice profile trees together• Context size used to estimate network cost

a30, 2100

c60, 810

a'11, 1200

main

main'19, 9

5

b50, 5900

a a

ca'

main

main'

b50, 520

a

MobileDevice Clone

Cellular Networks and Mobile Computing (COMS 6998-10) 49Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 50: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Partitioning: Optimization

• List all partitioning choices

• Remove partitioning choices that do not meet the constraints

• For each choice, compute total time

• Find the minimum

Cellular Networks and Mobile Computing (COMS 6998-10) 50Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 51: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Distributed Execution

How to seamlessly execute the partitions of an application locally and remotely

Cellular Networks and Mobile Computing (COMS 6998-10) 51Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 52: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Migration Architecture

App-VM

Migrator

NodeManager

NodeManagerNet

(1) (4)

Mobile Device Clone

Partitions

App-VM

Application

Migrator

App-VM

Migrator

Application

App-VM

Migrator

Clone

App-VM

Migrator

Clone

App-VM

Migrator

(2)

(3)

Cellular Networks and Mobile Computing (COMS 6998-10) 52Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 53: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Migration: Suspend-Transmit-Resume

Mobile device Clone

Transmit

At migration pointSuspend threadCapture context Transmit Launch process

Patch migrated contextResume thread

Suspend threadCapture contextMerge migrated

contextResume thread

At reintegration point

Cellular Networks and Mobile Computing (COMS 6998-10) 53Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 54: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Migration Challenges

• Regular IDs (references) not globally unique– Address space difference between mobile device

and clone

• System objects created at boot everywhere

Cellular Networks and Mobile Computing (COMS 6998-10) 54Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 55: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Migration: References in Motion

(1) Mobile Device

Reference MID CID0x01 1 null0x02 2 null0x03 3 null

migration

New objects

GC’ed

(2) Clone

Reference MID CID0x21 1 110x22 2 120x23 3 130x24 null 140x22 null 15

rein

tegr

ation(3) Mobile Device

Reference MID CID0x01 1 110x02 2 120x03 3 130x04 4 140x05 5 15

Cellular Networks and Mobile Computing (COMS 6998-10) 55Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 56: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

The CloneCloud v1 Prototype

• On Android platform + x86 VM clones• Modified DalvikVM to support thread-level

migration and dynamic profiling• Implemented NodeManager to handle

registration and communication• Static analysis using JChord

Cellular Networks and Mobile Computing (COMS 6998-10) 56Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 57: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Evaluation Setup

• Test applications– Image search– Virus scanning – Privacy-preserving user profiling

• Phone: Android Dev Phone 1• Clone VM: a server with a 3.0GHz Xeon CPU

running VMWare ESX 4.1 in Intel IT infrastructures

• Wireless connection: WiFi, T-mobile 3GCellular Networks and Mobile Computing

(COMS 6998-10) 57Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 58: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Execution Time Comparison (Image Search)

Exec

utio

n tim

e (s

econ

ds)

1 image 10 images 100 images0

500

1000

1500

2000

2500

Phone(Local)

CloneCloud(Wi-Fi)

CloneCloud(3G)

20x

1x

Cellular Networks and Mobile Computing (COMS 6998-10) 58Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 59: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Energy Consumption Comparison (Image Search)

Ener

gy c

onsu

mpt

ion

(J)

1 image 10 images 100 images0

300

600

900

1200

1500

1800

Phone(Local)CloneCloud(Wi-Fi)CloneCloud(3G)

20x

1x

Cellular Networks and Mobile Computing (COMS 6998-10) 59Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 60: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Discussion

• Applicability is application-specific– Application characteristics– Execution mechanism

• A design point with focus on automation– Apps structured to be more amenable to

migration• Clone VMs in untrusted environments

Cellular Networks and Mobile Computing (COMS 6998-10) 60Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 61: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Conclusion

• CloneCloud: automatic partitioning and migration to enhance mobile applications – Use of clones– Flexible app partitioning– Seamless migration

Cellular Networks and Mobile Computing (COMS 6998-10) 61Courtesy: Byung-Gon Chun et. al. 4/2/13

Page 62: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

62

mCloud Programming Model: COMET

1. Improve mobile computation speed2. Require no programmer effort3. Generalize well with existing applications4. Resist network failures

Courtesy: Mark Gordon et. al. 4/2/13

Page 63: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

63

Distributed Shared Memory COMET is offloading + DSM

Offloading bridges computation disparity DSM provides logically shared address space

DSM usually applied to cluster environments Low latency, high throughput

Mobile relies on wireless communication

Courtesy: Mark Gordon et. al. 4/2/13

Page 64: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

64

X=123

X=555X=555

X=555

X=?

X=?

X=123

DSM (continued) Conventional DSM (Munin)

X=123 Waited an RTT for a write Read could take RTT also

Courtesy: Mark Gordon et. al. 4/2/13

Page 65: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

65

Java Memory Model Dictates which writes a read can observe Specifies 'happens-before' partial order

Access in single thread totally ordered Lazy Release Consistency locking

Fundamental memory unit is the field Known alignment, known width

Courtesy: Mark Gordon et. al. 4/2/13

Page 66: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

66

Field DSM Track dirty fields locally Need 'happens-before' established?

Transmit dirty fields! (mark fields clean)

Not clear it scales well past two endpoints Not important to our motivation Use classic cluster DSM on server

Courtesy: Mark Gordon et. al. 4/2/13

Page 67: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

67

VM-synchronization Used to establish 'happens-before' relation Directed operation between pusher and

puller Synchronizes

Bytecode sources Java thread stacks Java heap

Courtesy: Mark Gordon et. al. 4/2/13

Page 68: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

68

Bytecode Update (Step 1 of 3) Operation begins by sending any new code

I loaded file xyz.dex

I have xyz.dex cached

Pusher

PullerCourtesy: Mark Gordon et. al. 4/2/13 Cellular Networks and Mobile Computing (COMS 6998-10)

Page 69: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

69

Stack Update (Step 2 of 3) Next we send over thread stacks

Thread id: 2job2::run pc:5 registers[42, 555, 0]workLoop pc:6 registers[0, [obj:9]]start pc:3 Registers[101, [obj:9]]

PusherPuller

nom

4/2/13

Page 70: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

70

Heap Update (Step 3 of 3) Finally send over heap update

We send updates to any changed (or new) field Only send updates of 'shared' heap

PusherPuller

[obj:2].y = 1[obj:4].z = [obj:3]...

4/2/13

Page 71: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

71

Lock ownership Annotate with lock ownership flag Establish 'happens-before' with VM-sync

Courtesy: Mark Gordon et. al. 4/2/13

Page 72: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

72

Thread Migration Thread migration trivial

Push VM-sync Transfer lock ownership

PusherPuller4/2/13

Page 73: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

73

Native Methods Written in C with bindings for Java

Math.sin(), OSFileSystem.write(), VMThread.currentThread()

Native methods exist to Access device resources (file system, display, etc) For performance reasons To work with existing libraries

Not generally safe to run on either endpoint Manually white list safe native methods

Courtesy: Mark Gordon et. al. 4/2/13

Page 74: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

74

X=555X=557

Thread 1 foo() r0=[X] r0=r0+1 [X]=r0 > bar()

X=556

Thread 1 foo() r0=[X] r0=r0+1 [X]=r0 > bar()

X=556

Failure Recovery VM-synchronization is recovery safe Always leave enough information on client If server is lost resume threads running

locally!

Thread 1 > foo() r0=[X] r0=r0+1 [X]=r0 bar()

Thread 1 > foo() r0=[X] r0=r0+1 [X]=r0 bar()

X=555

Courtesy: Mark Gordon et. al. 4/2/13

Page 75: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

75

X=556X=555

Thread 1 foo() r0=[X] r0=r0+1 [X]=r0 > bar()

Thread 1 foo() r0=[X] r0=r0+1 [X]=r0 > bar()

X=556

Failure Recovery VM-synchronization is recovery safe Always leave enough information on client If server is lost resume threads running

locally!

Thread 1 > foo() r0=[X] r0=r0+1 [X]=r0 bar()

Thread 1 > foo() r0=[X] r0=r0+1 [X]=r0 bar()

X=555

Courtesy: Mark Gordon et. al. 4/2/13

Page 76: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

76

Tau-Scheduler

Τ = 2 * VM-synchronization time

Courtesy: Mark Gordon et. al. 4/2/13

Page 77: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

77

Implementation Built from gingerbread CyanogenMod source ~5000 lines of C code JIT not included

Engine.c:offMigrateThread() offWriteU1(self, OFF_ACTION_MIGRATE); deactivate(self); offThreadWaitForResume(self);

Courtesy: Mark Gordon et. al. 4/2/13

Page 78: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

78

Evaluation Setup Samsung Captivate (1 GHz Hummingbird)

2 x 3.16GHz quad core Xeon X5460 cores

Courtesy: Mark Gordon et. al. 4/2/13

Page 79: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

79

Benchmarks 8 applications from Google Play

Average speed-up of 2.88X on WiFi / 1.28X on 3G Average energy saving of 1.51X on WiFI / 0.84X on 3G

2 computation benchmark applications 10.4X speed-up w/ WiFi on Linpack 200+X speed-up w/ multi-threaded factoring

Courtesy: Mark Gordon et. al. 4/2/13

Page 80: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

80

Rhino Java JavaScript Interpreter

Ran with SunSpider JavaScript benchmark

4/2/13

Page 81: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

81

Conclusion Offloading+DSM=COMET

Improve computation speed No programmer effort Generalize well Resist network failures

4/2/13

Page 82: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Cellular Networks and Mobile Computing (COMS 6998-10)

82

Contributions Design/Impl. with four simultaneous goals

Fine granularity offloading Mutli-threading support

Field based DSM coherency

4/2/13

Page 83: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Programming Model: Odessa• Data flow graph: vertices are stages; edges are connectors;

stages share nothing

83Face Recognition Gesture RecognitionCellular Networks and Mobile Computing

(COMS 6998-10)Object Pose Estimation

Source: Odessa Mobisys presentation

4/2/13

Page 84: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Programming Model: Odessa (Cont’d)

• Offloading DEcision System for Streaming Applications

NetworkApplication

Sprout

Odessa

Mobile Device

Application

SproutOdessa Profiler

Cloud Infrastructure

OdessaRuntime Profiler Decision

Engine

Cellular Networks and Mobile Computing (COMS 6998-10) 84Source: Odessa Mobisys presentation4/2/13

Page 85: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

mCloud Programming Model: Odessa (Cont’d)

85

B2

Network

CB A

B1 A

Application Data Flow Graph Screen

C

Local Execution

Cost

RemoteExecution

Cost>Cellular Networks and Mobile Computing (COMS 6998-10)Smartphone

Cloud Infrastructure

Incremental decisions adapt quickly to input and platform variability.

Source: Odessa Mobisys presentation4/2/13

Page 86: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Support for Service Interaction

• Synergy of mCloud services– Shared basic services enables more efficient usage of

cloud resources(e.g. shared memcache eliminates data duplication of individual services)

– Co-location makes mashed-up applications to achieve native performance (file transfer becomes an object reference)

• mCloud offers shared platform services• mCloud optimizes service interaction through

active VM migration86Cellular Networks and Mobile Computing

(COMS 6998-10)4/2/13

Page 87: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Closing Thoughts

• Cloud computing needs to advance in architecture, programming model, platform services to revolutionize mobile computing

87Cellular Networks and Mobile Computing (COMS 6998-10)4/2/13

Page 88: Instructor: Li  Erran  Li ( lel2139@columbia.edu )  ~lierranli/coms6998-10Spring2013/ 4 / 2 /2013: Mobile Cloud Computing

Useful Tools

• Hprof: a heap/CPU profiling tool• Jchord: a static analysis tool on Java bytecode• Dummynet (ipfw): simulates/enforces queue

and bandwidth limitations, delays, packet losses

• OpenCV: a library of programming functions for real time computer vision

Cellular Networks and Mobile Computing (COMS 6998-10) 884/2/13