accelerating mobile applications through flip-flop replication mark gordon, david ke hong, peter m....

24
Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

Upload: loren-lamb

Post on 25-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

Accelerating Mobile Applications through Flip-Flop Replication

Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

Page 2: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

2

Challenges of offload

• Use cloud resources to accelerate mobile apps

Get user input

Display output

UI phase

Compute phase

Page 3: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

3

Challenges of offload

• Use cloud resources to accelerate mobile apps

Get user input

Display output

Send inputs

Compute phase

Receive outputs

Page 4: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

4

Challenges of offload

• Use cloud resources to accelerate mobile apps

Get user input

Display output

UI phase

Compute phase

Challenges:• Need large compute chunks• Compute inputs/outputs must be small & predictable• Cannot safely offload chunks with external output• Must predict resource usage & supply

Page 5: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

5

Don’t migrate – replicate!

• Tango executes on both mobile and cloud– Ensures that both executions are the same– Can use output from either execution

• Tango shows benefits for:– A broader set of compute-intensive segments– Network-intensive segments

Page 6: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

6

Deterministic replay

• Record an execution, reproduce it later– Most parts of execution are deterministic– Just need to record/replay non-deterministic ones

• Thread scheduling, network input, user input, etc.

LogRecordedExecution

Non-DeterministicEvents Replayed

Execution

Page 7: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

7

Compute-intensive application

Get user input

Get user input

Display output

Page 8: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

8

Network-intensive application

Query web service

Query web service

Query web service

Get user input

Page 9: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

9

Network-intensive application

Query web service

Query web service

Query web service

Get user input

Display output

Page 10: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

10

Tango architecture

Dalvik VM

Storage Stack

UI Stack

Most Native Code

Rem. Native Code

Sensor I/O

User I/O

Dalvik VM

Storage Stack

UI Stack

Most Native Code

Network I/O

Async. Scheduling Time

Page 11: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

11

Leader switching

• Implementation:– Leader pauses, sends switch request to follower– Follower either accepts or sends a NACK message

1. Only switch when follower is (almost) caught-up– Detect by observing lag between requests & responses

2. Only switch when application phase appropriate– Detect by observing amount of compute and I/O– Yes, we are doing some prediction– But, we are also hedging our bets with 2 replicas

Jason Flinn

Page 12: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

12

Fault tolerance

• Problem: external output

Page 13: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

13

Fault tolerance with Tango

• Tango can tolerate a server stop-failure– Log-based rollback recovery

• If cloud server is leader, before output:– Stores prior non-determinism on 2nd server

• On server failure:– Mobile replicas is checkpoint of app state– Use stored log to roll forward to last output

Jason Flinn

Page 14: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

14

Fault tolerance

• Solution: Backup server keeps recovery log

Page 15: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

15

Evaluation

• Methodology– Samsung Galaxy S3 smartphone (Android 4.2.2)– Replay server (3.4GHz i5 processor, 4GB RAM)– 2 compute-intensive apps, 5 network apps

• Questions to answer:– Does Tango improve interactive performance?– What is Tango’s effect on client energy usage?

Page 16: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

16

Interactive latency

Sudoku Poker TapTu Hoot Email Instagram Pinterest0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Tango-100ms Tango-500ms

Rela

tive

Late

ncy

Page 17: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

17

Client energy usage

Sudoku Poker TapTu Hoot Email Instagram Pinterest0

0.10.20.30.40.50.60.70.80.9

11.1

Tango

Rela

tive

ener

gy u

sage

Page 18: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

18

Conclusion

• Don’t migrate - replicate!– Execute on both mobile client and server– Determinism ensures same output– Leadership moves between replicas– Can lead to 2-3x performance improvements

• Questions?

Page 19: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

19

Communication

Sudoku Poker TapTu Hoot Email Instagram Pinterest0

2

4

6

8

10

12

14

16

18

Receive Send

Dat

a (K

B/s)

Page 20: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

20

Lessons learned

• Hard to enforce determinism in Dalvik VM– Too many native methods– Too many interactions with system services– Support for JIT, ART possible, but a lot of work

• Offload of network apps is promising– Need to think carefully about fault tolerance

Page 21: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

21

Implementation

• Dalvik VM mostly deterministic– Added deterministic thread scheduling– Leader decides timing of input, async events

• Native methods– Default behavior: run once on mobile device– Optimization: make deterministic and replicate

Jason Flinn

Page 22: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

22

External I/O

• Natural affinity to one replica:– Mobile: UI, IPC, and sensors– Cloud: network

• Proxy receives inputs, broadcasts to replicas• Leader decides when input events occur

• Leader sends outputs to proxy

Jason Flinn

Page 23: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

23

Internal non-determinism

• Some components replicated & deterministic– UI Stack: Many low-level interactions– Storage: File system and DB accesses

• Other components handled by leader:– Scheduling of asynchronous events– Time queries– Randomness (/dev/random)

Page 24: Accelerating Mobile Applications through Flip-Flop Replication Mark Gordon, David Ke Hong, Peter M. Chen, Jason Flinn, Scott Mahlke, Z. Morley Mao

24

Macrobenchmark

• Computation-heavy apps: 2~3x speedup• Network apps: 0~2.6x speedup

Benchmark Interaction Network RTTs

Sudoku Solving a Sudoku grid given a single cell N/A

Poker Compute winning probability from initial state N/A

Hoot Update Twitter given a keyword 5

TapTu Update Facebook feed 4

Email Update Email’s inbox 4

Instagram Update Instagram posts 3

Pinterest Update Pinterest boards 2~8