Informed Mobile Prefetching T.J. Giuli † Christopher Peplin † David Watson †‡ Brett Higgins Jason Flinn Brian Noble † ‡
Informed Mobile Prefetching
T.J. Giuli†
Christopher Peplin†
David Watson†‡
Brett HigginsJason Flinn Brian Noble
† ‡
Brett Higgins 2
Prefetching + Mobile Networks
Time, distance
$#&*!!
Phone activity
Read article
Phone activity
Slow fetch
PrefetchArticle loads instantly
Sleeping
Brett Higgins 4
A Tale of Two Apps
• Four hours later:• Battery died hours ago• Fetch time: INF
• Four hours later:• Battery: 10%• Fetch time: many seconds
Scenario:50% battery
4 hours until recharge
We must conserve energy!(…no big surprise there.)
✖
Brett Higgins 5
A Tale of Two Apps
• One hour later:• Battery: 5% (charging)• Fetch time: << 1 second
• One hour later:• Battery: 40% (charging)• Fetch time: many seconds
Scenario:50% battery
1 hour until recharge
It’s okay to spend resources……if it will benefit the user.
(And if we can spare the resources.)
✖
Brett Higgins 6
One more scenario: Reality
• The only scenario that matters• Network conditions change rapidly• User/app behavior changes too
• No one strategy is always best• Even for two scenarios
• Mobile prefetching is complex.• Must consider:
• Network availability/quality• Network energy cost model• Overall resource spending• Time until resource replenishment• Observed usefulness of prefetching…
• But the benefits could be great!
Brett Higgins 7
So, who should deal with it?• Users?
• Monitor resources, networks• Adjust behavior• Fiddle with app settings
• Developers?• Monitor resources, networks• Observe user behavior• Adjust prefetch strategy
Brett Higgins 8
Informed Mobile Prefetching
• System support for prefetching on mobile networks• Applications specify hints• What & how to prefetch
• System decides when to prefetch• Monitors network availability and quality• Tracks resource spending over time• Adjusts the importance of energy/data conservation• Tracks how often the user consumes hinted data
Brett Higgins 9
Roadmap
• Motivation• IMP Design & Implementation• Interface• Prefetch decision algorithm
• Applications & Evaluation• Summary
Brett Higgins 10
IMP Interface
• App passes a Fetcher• Callback to fetch data• Size of data item• Optional prefetch class
• IMP returns a Future• Handle for future access• get() invokes app fetch
• Intentional Networking• Simple use of multiple networks• Prioritize FG traffic over
prefetches
Application
IMP
Intentional Networking
prefetch()get()
fetch()
Brett Higgins 11
How to decide when to prefetch?
• Core: cost/benefit analysis• Inspired by TIP (SOSP ‘95)
• Benefit: time savings• Cost: energy, cellular data• Prefetch when:• Benefit > cost
• How to calculate?• How to compare?
HintsIMP
BenefitCost
Brett Higgins 12
How to decide when to prefetch?
• Network measurements• Bandwidth, RTT, availability
• Benefit = future fetch time• Cost = energy + data• PowerTutor power model
(CODES+ISSS ‘10)• (Current cost) – (future cost)
• Future depends on user• How often is data used?
HintsIMP
BenefitCost
Observations:Bandwidth
RTTPower state
Brett Higgins 13
How to decide when to prefetch?
• API lets us track accuracy• Fraction of hinted data used• “Used” = get()• “Not used” = cancel()
• Use accuracy in calculations• e.g. benefit = time × accuracy
• Per-class accuracy estimate• If app specifies classes
HintsIMP
BenefitCost
Observations:Bandwidth
RTTPower state
Accuracy of prefetch
hints
Brett Higgins 14
How to decide when to prefetch?
• Budgeted resources• Fixed, replenishable capacity• Time period to spend
• Approach: Price is Right™• Spend close to budget• But not over budget!
• Goal-directed adaptation• Odyssey (TOCS ‘04)• Measure resource spending• Adjust resource importance
HintsIMP
BenefitCost
UserTime
Energy,Data
Observations:Bandwidth
RTTPower state
Accuracy of prefetch
hints
Brett Higgins 15
How to decide when to prefetch?
• Re-evaluation• Outcome may change later
• Network conditions change• Resource spending slows
• Periodically re-run analysis
• Batching• Can amortize tail energy cost• Evaluate all batch sizes• Prefetch when benefit > cost
• For any batch size
HintsIMP
BenefitCost
UserTime
Energy,Data
Observations:Bandwidth
RTTPower state
Accuracy of prefetch
hints
New batch,or wait a bit
Brett Higgins 16
Roadmap
• Motivation• IMP Design & Implementation• Interface• Prefetch decision algorithm
• Applications & Evaluation• Summary
Brett Higgins 17
Applications
• K9 email client• Popular Android email client• Supported transparently via IMP-aware IMAP proxy• Default: prefetch emails over 32KB
• OpenIntents News Reader• Open-source Android Atom/RSS feed reader• Added IMP support code• Default: no article text/media prefetching (summary only)
Brett Higgins 18
Evaluation: Methodology
• Gathered network trace in a moving vehicle• Sprint 3G & open WiFi• BW up/down, RTT
• Replayed in lab (trace map
here)
Brett Higgins 19
Evaluation: Comparison Strategies
• Never prefetch• Prefetch items under a size threshold• App-specific threshold value
• Prefetch only over WiFi• Always prefetch
• Common heuristics; simple to implement
Brett Higgins 21
Evaluation Results: Email
• All resource goals met• Much smaller fetch time• Within 300ms of “always”• 2-8x less than others
• Walking trace on campus• Similar results
Brett Higgins 23
Evaluation Results: News
• All resource goals met• Smaller fetch time
• Whenever other strategies meet the goals
• Walking trace on campus• Similar results*
* …with one exception.
Brett Higgins 25
Evaluation Results: News
• Effect of prefetch classes• Lower average fetch time• Meet goals more reliably
• Small developer effort• Significant improvement
Brett Higgins 26
Summary
• Informed Mobile Prefetching• App supplies prefetch hints• System decides when to prefetch• Manages budgeted resources
• “Price is Right” approach
• Tracks prefetch accuracy• Avoids wasteful prefetching
• Meets all resource goals• Improves average fetch time in most cases
• Compared to simple strategies that meet same goals