Code Offload with Least Context Migration in the Mobile Cloud

advertisement
Code Offload with Least Context
Migration in the
Mobile Cloud
Yong Li and Wei Gao
The University of Tennessee, Knoxville
IEEE INFOCOM 2015
Outline
 Introduction
 Motivation and related works
 System design
 Technical details
 Evaluation
IEEE INFOCOM 2015
Outline
 Introduction
 Motivation and related works
 System design
 Technical details
 Evaluation
IEEE INFOCOM 2015
Cloud Computing for Mobile Devices
 Contradiction between limited battery and
complex mobile applications
 Mobile Cloud Computing (MCC)
 Offloading local computations to remote execution
IEEE INFOCOM 2015
General Problems for Offloading
 What to offload
 Developers’ annotation, such as MAUI, ThinkAir
 Online profiling, such as Odessa, COMET
 How to offload (Our Focus)
 Wrap the offloading method as RPC, like MAUI
 VM synthesis, like CloneCloud, COMET
IEEE INFOCOM 2015
Outline
 Introduction
 Motivation and related works
 System design
 Technical details
 Evaluation
IEEE INFOCOM 2015
Existing Work
 Restrict to a specific set of system frameworks
and mobile applications
 Unable to support existing mobile applications
without modification, like MAUI and ThinkAir
 Migrate a large amount of application
contexts
 Unnecessary contexts have been sent, like CloneCloud
and COMET
 Wireless communication is expensive!
IEEE INFOCOM 2015
Motivation
 Only part of memory contexts are necessary.
1 class Sample extends Activity {
2 public void calculate() {
3 TestObject[] objs = new TestObject[5];
4 TestObject[] subobjs = new TestSubObject[4];
5 int result = bar(objs[0], subobjs[1]);
6 }
7 int bar(TestObject to1, TestObject to2) {
8 String val;
9 if(TestObject.si > 3)
10
val = to1.getS();
11 else val = to2.getS();
12 return TestObject.si++;
13 }}
Heap
Thread
Stack Frame
Program Counter
Method:calculate
Reg: objs
Reg: subObjs
Reg: this
Stack Frame
Program Counter
Method:bar
Reg: val
Reg: this
Reg: to1
Reg: to2
14
15
16
17
class TestObject {
static int si = 5; String str = "str";
public String getS() { return str; }
}
18
19
20
21
class TestSubObject extends TestObject {
double num = 3.2; String substr = "substr";
Reg = Local variables &
public String getS() { return substr; }
Parameters
}
IEEE INFOCOM 2015
0 1 2
3
0 1 2
3
4
subObj1
Sample
obj0
Motivation
 Only part of memory contexts are necessary.
IEEE INFOCOM 2015
Outline
 Introduction
 Motivation and related works
 System design
 Technical details
 Evaluation
IEEE INFOCOM 2015
Insights
 Integrate with Android OS
 Support existing application without modification
 Automatic method offloading in Dalvik VM
 Migrate least but sufficient memory context
 Offline parsing to identify relevant memory context
for a method
 Utilize parsing result metadata to screen memory
contexts during run-time execution
IEEE INFOCOM 2015
System Design
 Components:
 Offline parsing - identify the relevant contexts
 Run-time migration – handle offloading process
Offline Parsing
Mobile
Cloud
1. Parsing req
Application
Installer
Method Argument
Parsing Component
Application
Method
Metadata
APK
2. Send back
3. load
Dalvik Virtual Machine
Thread 2
Thread 1
Calculate()
Method
Metadata
Dalvik Virtual Machine
4. Migrate to
cloud
...
Heap
Class Static Field
Parsing Component
Thread 1
5. Context load &
execute
bar()
Calculate()
TCPMUX
Heap
6. Migrate back
Communicate
TCPMUX
IEEE INFOCOM 2015
Run-time Migration
Outline
 Introduction
 Motivation and related works
 System design
 Technical details
 Evaluation
IEEE INFOCOM 2015
Input data sources for method
 Two input data sources for a method:
 Method arguments
 Class static fields
this
IEEE INFOCOM 2015
Offline Parsing Components
 Method Argument Parsing Component
To determine which fields in the input arguments may be
accessed during method execution.
 Go through all the possible execution paths
 Emulate the instruction effects to find out the
accessing field of an object
 Class Static Field Parsing Component
To find out which class and its static fields may be operated
by a method.
 Parse only the static field access instructions
IEEE INFOCOM 2015
Method Argument Parsing Component
 Go through all the possible execution paths
bar()
Control statements
TestObject.si
>3
to1.getS()
<=3
to2.getS()
TestObject
.getS()
TestSubObject
.getS()
TestObject
.getS()
TestSubObject
.getS()
return
return
return
return
Polymorphism
IEEE INFOCOM 2015
Method Argument Parsing Component
 Emulate the instruction effects to find out the
accessing field of an object
public String getS() { return str; }
iget-object v0, v1, LTestObject;.str
Object
Manipulation
(Read):
v0
v1
put str to v0
to1: str num substr
IEEE INFOCOM 2015
Class Static Field Parsing Component
 Identify relevant class static field
 Parsing instructions manipulating class static field
 Not considering execution paths
if (TestObject.si > 3)
sget v1, LTestObject;.si
v1
put si to v1
TestObject:
IEEE INFOCOM 2015
si
Metadata Maintenance
 Java object can be organized as a tree-based
structure
 Record Parsing result by breadth-first traversal
of the object trees
IEEE INFOCOM 2015
Run-time Migration Component
1. Method Invocation Tracking
Cloud
Mobile
Dalvik Virtual Machine
Dalvik Virtual Machine
Thread 1
2. Context Migration
to the Cloud
Thread 1
Calculate()
bar()
Calculate()
Heap
3. Context
Reload
on the
Cloud
Heap
4. Context Migration Back to Local Device
IEEE INFOCOM 2015
Context Migration to the Cloud
 Offline parsing result metadata
 Dirty flag for every memory object by DSM
Mobile
Cloud
Heap Context
to1:
to2:
str num substr
Heap Context
Migrate str
to1: str
str
str num substr
str num substr
TestObject:
Migrate substr
to2: str num substr
Migrate si
si
TestObject: si
si
Migrate si back
IEEE INFOCOM 2015
Outline
 Introduction
 Motivation and related works
 System design
 Technical details
 Evaluation
IEEE INFOCOM 2015
Performance Evaluations
 Evaluation metrics:
 Method execution time
 Amount of energy saved
 Amount of data transmission
 Comparison with existing work:
 For some experiments, we compare our system with
COMET on data transmission and overhead
IEEE INFOCOM 2015
Evaluation Setup
 Evaluation against real Android mobile apps
 Metro trip planner, Poker assistant, Sudoku game
 Offloading decision
 Same as COMET - History average execution time over
a threshold
 Experiments
 30 times with different input datasets for each
application
IEEE INFOCOM 2015
Offloading Effectiveness
5 times speed up
40% energy saved
IEEE INFOCOM 2015
Offloading Effectiveness
 Amount of data transmission during workload
offloading
Reduce 40% of data transmission for the first time offloading
Reduce 70% of data transmission after first time offloading
IEEE INFOCOM 2015
Parsing complexity
By reducing the nested
branching depth, we
can reduce the parse
time significantly
without affecting too
much parsing method
coverage
IEEE INFOCOM 2015
Offloading Overhead
 Measured as average amount of time spent on
collecting the memory contexts to be migrated
Slightly less overhead
IEEE INFOCOM 2015
Thank you!
 Questions?
 The paper and slides are also available at:
http://web.eecs.utk.edu/~weigao
IEEE INFOCOM 2015
Download