Procrastinator: Pacing Mobile Apps’ Usage of the Network mobisys 2014.

Post on 02-Jan-2016

214 views 1 download

Transcript of Procrastinator: Pacing Mobile Apps’ Usage of the Network mobisys 2014.

Procrastinator: Pacing Mobile Apps’ Usage of the Network

mobisys 2014

Outline

• Motivation• Design and Implementation• Evaluation• Overhead

Motivation

• App developers rely heavily on prefetching network content at the launch of an app to hide the network latency of cellular communication.

Motivation

• For some users, they don’t visit off-screen content.• This waste harm three sets of users– 1. users that are always conscious about data because

they are on a pay-per-byte plan.– 2.users that start their monthly cellular billing cycle

with a large number of bytes, but eventually run low and want the remaining bytes to last them through the end of their cycle.

– 3.users that have large data plans at home but are temporarily roaming.

How to save data?

• 1. It should automatically identify asynchronous network calls that are candidates for procrastination

• 2. decide whether to procrastinate each candidate call, and when to execute a previously procrastinated call.

• present Procrastinator– Instrumenter– Procrastinator Runtime

How to prefetch network content?

• Three programming patterns– Pattern 1: the app developer assigns an image to an image

element that is not visible on screen. example: news reader app only top 3 or 4 is visible.

– Pattern 2: additional processing is required before displaying the fetched data. The UI elements may not be visible.

– Pattern 3: the assignment to the UI element is delayed even further. For example, weather app. At launch, the app fetches data about hurricane warnings, which it stores in a global variable. The data is used only if the user navigates to a specific tab or a “page”.

Design and Implementation

How to look for prefetching patterns?

• Pattern 1– the instrumenter looks for any HTTP fetch API calls

that are set to a UI element’s source.

How to look for prefetching patterns?

• Pattern 2– the developer passes a callback function to the network call.

The network call asynchronously fetches data and invoke the callback with the data. The UI elements are then accessed and updated in the callback.

• static analysis:– find the callback method associated with the call– generate a conservative call graph that is rooted in the

callback method.– analyze code in the conservative call graph to discover all UI

elements being update– analyze code in the call graph to ensure it has no side effect.

How to look for prefetching patterns?

• Pattern 3– two passes of static analysis– In the first pass• analyze network callbacks to identify global variables used

in store operations.(similar to Pattern 2)

– In the second pass• analyze the rest of the app code to identify code where

the same global variables are accessed in load operations.

Procrastinator Runtime

• Procrastinator Runtime behavior for pattern 1,2

Procrastinator Runtime

• Procrastinator Runtime behavior for pattern 3

Define

• necessary– If we cannot deduce whether the content of web objects is

used in the screen, we conservatively assume them to be “necessary”

– If a web object is not necessary, then it is either “skipped” or “prefetched”

• skipped– If Procrastinator correctly deduces that a network is not

necessary and doesn’t download it.• prefetched

– If Procrastinator allows an object to be downloaded that is not necessary. (delayed)

Evaluation Results

Overhead