![Page 1: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/1.jpg)
Timecard:Controlling User-Perceived Delays in
Server-Based Mobile Applications
MIT, Microsoft Research
Lenin Ravindranath, Jitendra Padhye, Ratul Mahajan, Hari Balakrishnan
![Page 2: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/2.jpg)
Cloud Services
Mobile Apps
![Page 3: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/3.jpg)
Response Time MattersUsers are impatient
![Page 4: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/4.jpg)
![Page 5: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/5.jpg)
User interaction Rendering
User-perceived delay
Tightly control
![Page 6: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/6.jpg)
App App
ServerUplink Downlink
User interaction Rendering
Server processing delay
App processing delay
Appprocessing delayRequest
transfer delayResponse
transfer delay
User-perceived delay
Tightly control
![Page 7: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/7.jpg)
ServerUplink Downlink
Server delayControl
App AppUser interaction Rendering
Server processing delay
User-perceived delay
Tightly control
Control Server Delay
![Page 8: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/8.jpg)
Request Response
Deadline
Server processing
Controlling the Server Delay
• Trade-off quality of result for processing time– More time to process, better quality results
Server
![Page 9: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/9.jpg)
Request Response
Deadline
Controlling the Server Delay
WorkerWorker
Worker
Worker
Worker
Server
![Page 10: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/10.jpg)
Request Response
Deadline
Controlling the Server Delay
WorkerWorker
Worker
Worker
Worker
Better result
Server
![Page 11: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/11.jpg)
Deadline
Controlling the Server Delay
Server
Server processing
• Servers keep fixed deadlines– No consideration about external delays– Assume constant external delays
Assumed external delay
Assumed external delay
![Page 12: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/12.jpg)
Device type Data size
TCP stateTCP state
Device type
Significant Variability in External Delays
App App
Server
User interaction Rendering
Server processing
Reading sensors
Radio state
Network(3G, WiFi, LTE, ..)
RTT, tput
Highly variable[AppInsight – OSDI ’12]
![Page 13: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/13.jpg)
Significant Variability in External Delays
Server
• Client with high external delays– Poor end-to-end response time
• Client with low external delays– Do not produce the best quality result
Deadline
![Page 14: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/14.jpg)
Significant Variability in External Delays
Server
Servers should adapt to external delaysto control the user-perceived delay
![Page 15: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/15.jpg)
Significant Variability in External Delays
Server
Deadline
![Page 16: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/16.jpg)
Significant Variability in External Delays
Server
Adapt
![Page 17: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/17.jpg)
Significant Variability in External Delays
Server
User interaction Rendering
End-to-end deadline
Adapt
App App
![Page 18: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/18.jpg)
Timecard
App App
Server
![Page 19: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/19.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Time elapsed since user interaction
Predicted downlink & app processing delay
Adapt
![Page 20: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/20.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Desired end-to-end delay
Adapt Processing Time
![Page 21: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/21.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Adapt Processing Time
Trade-off on quality of the result
Desired end-to-end delay
![Page 22: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/22.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Adapt Response
Desired end-to-end delay
![Page 23: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/23.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Adapt Response
Desired end-to-end delay
![Page 24: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/24.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Better quality result
Desired end-to-end delay
![Page 25: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/25.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Time elapsed since user interaction
Predicted downlink & app processing delay
![Page 26: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/26.jpg)
Challenges
Server
App App
![Page 27: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/27.jpg)
Challenges
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Server
App
UI dispatcherWeb callback
AppHighly asynchronous
![Page 28: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/28.jpg)
Server Threads
Challenges
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
Transaction
Highly asynchronous
![Page 29: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/29.jpg)
Challenges
Server
App App
GetElapsedTime();
No single reference clock
Variable network delaysand processing delays
PredictRemainingTime(responseSize);
Transaction
Highly asynchronous
![Page 30: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/30.jpg)
Timecard
Server
App App
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 31: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/31.jpg)
Timecard
App
App Instrument
er
InstrumentedApp
Service
Developer
Timecard.dll
GetElapsedTime();PredictRemainingTime
(responseSize);
Desired end-to-end delay
config
App Store
![Page 32: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/32.jpg)
Timecard
Server
App App
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 33: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/33.jpg)
Timecard
Server
App App
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 34: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/34.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
Transaction
![Page 35: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/35.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Track across thread boundaries o at the app and at the server
![Page 36: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/36.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
Track between app and server
![Page 37: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/37.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
Transaction
![Page 38: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/38.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
TC
TC
TC
TC
TC
TC
TC
TC
TC
TC
Transaction context (TC) attached to every thread– Carry along timestamps, transaction information
![Page 39: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/39.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
TC
TC
TC
TC
• Event handler – create new Transaction context (TC)– Timestamp and attach to thread
• Asynchronous call – Pass TC from current thread to callback thread– Pass TC by detouring callbacks [AppInsight – OSDI ‘12]
![Page 40: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/40.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
TC
TC
TC
TC
![Page 41: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/41.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
TC
TC
TC
TC
TC
HTTP[“x-Timecard-Request”]
TC
• Web Request – pass TC from current thread to server– Encode TC in a special HTTP header
• Request handler at server – Parse TC and attach to server thread
![Page 42: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/42.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
TC
TC
TC
TC
TC
TC
![Page 43: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/43.jpg)
Server Threads
Transaction Tracking
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
Spawn workers
Send response
UI dispatcherWeb callback
Server
App App
Request handler
TC
TC
TC
TC
TC
TC
TC
TC
TC
TC
TC
GetElapsedTime();
![Page 44: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/44.jpg)
Timecard
Server
App App
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 45: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/45.jpg)
TimeSync
GPS
• Sync with Cell Tower– Off my several seconds to minutes
• GPS– Does not work indoors
• Probing
Probe
![Page 46: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/46.jpg)
TimeSync
Instrument app to automatically send probes
Probe
Symmetric Asymmetric
Clock offsetClock drift
Smartphone clock Server clock
![Page 47: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/47.jpg)
TimeSync
Probe
Radio wakeup delay
with large extra delay
Active
IdleIdle
Network Radio States
![Page 48: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/48.jpg)
TimeSync
Queuing delay
with large extra delay
Probe
Network traffic
Active
Idle
Active
![Page 49: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/49.jpg)
TimeSync
Network busy
Radio idle
> 100ms error
min RTT
![Page 50: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/50.jpg)
TimeSync
Optimal time to send the probes Radio is active No network traffic from the phone
Need to be radio-aware and network-aware
Probe
![Page 51: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/51.jpg)
TimeSync
Server
App App
![Page 52: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/52.jpg)
TimeSync
UI Thread
Background Thread
Background Thread
Thread start
GPS start
Web requestGPS callback
Event handler
App
Probe
![Page 53: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/53.jpg)
TimeSync
~5ms error
Network busy
Radio idleTimecard
min RTT
![Page 54: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/54.jpg)
Timecard
App App
Server
GetElapsedTime();
Time elapsed since user interaction
![Page 55: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/55.jpg)
Predicting Remaining Time
App App
Server
PredictRemainingTime(responseSize);
Downlink delay App processing delay
![Page 56: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/56.jpg)
Predicting Downlink Delay
Response sizeLatencyThroughput
Loss rate
TCP window state• Most transfers are short– Median – 3KB– 90% percentile – 37KB
Analysis of 4000 apps
• Cellular networks– High-bandwidth, rare-loss,
high-latency,
• 99% transfers over HTTP– TCP window state matters -> multiple RTTs
![Page 57: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/57.jpg)
Predicting Downlink Delay
TCP Window
1 extra RTT
![Page 58: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/58.jpg)
Predicting Downlink Delay
Response sizeLatency
TCP parameters
Determined by RTT Number of round trips
![Page 59: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/59.jpg)
Predicting Downlink Delay
• Use recent estimate of RTT– Use time sync probes
Read TCP window state
• Read TCP window state at serverMiddlebo
x• Do not work with middleboxes
– Split-TCP connection
• TCP window state at the middlebox matters– No easy way to estimate
TCP window state
Build an empirical data-driven model
RTT
Number of round trips
![Page 60: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/60.jpg)
Predicting Downlink DelayPredictRemainingTime(responseSize);
Learn
• Decision tree model– Response size– Recent RTT– Network provider– Bytes already transferred in
the TCP connection o Proxy for TCP window state at the
middlebox
Middlebox
Downlink Delay Predictor
![Page 61: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/61.jpg)
• 20 users + controlled experiments– 1 month, two cities
• 250,000 downloads– 1 KB to 500KB
• AT&T, T-Mobile, Sprint, Verizon, Wi-Fi– 3G, 4G (HSPA+), LTE
• Indoors, outdoors, static, walking, driving
Predicting Downlink Delay
• Split the data into training and testing
Wi-Fi Median error - 12 ms, 90th percentile - 31ms
Cellular Median error - 17 ms, 90th percentile - 86 ms
![Page 62: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/62.jpg)
Predicting App Processing Delay
App App
Server
PredictRemainingTime(responseSize);
![Page 63: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/63.jpg)
Predicting Remaining Time
App App
Server
PredictRemainingTime(responseSize);
Processing Delay Predictor
Downlink Delay Predictor
![Page 64: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/64.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
D
e rd = D – e – r
Desired end-to-end delay
![Page 65: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/65.jpg)
• Mobile ads service• Twitter analysis service
Deployment
![Page 66: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/66.jpg)
Mobile Ads ServiceContextual ads to mobile apps [Mobisys ’13]
![Page 67: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/67.jpg)
Mobile Ads Service
Fetch and process ads for keywords
Extract keywords Render adSend keywordsBest Ad
![Page 68: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/68.jpg)
Mobile Ads Service
Extract keywords Render adSend keywordsAd
Ad providerAd provider
Ad provider
Ad provider
Ad provider
A
Keywords
![Page 69: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/69.jpg)
Mobile Ads Service
Extract keywords Render adSend keywordsAd
![Page 70: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/70.jpg)
Mobile Ads Service
Extract keywords Render adSend keywordsAd
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Adapt Processing Time
![Page 71: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/71.jpg)
Mobile Ads Service• ~200,000 transactions• Significant variability in external delay
Within 50ms of the target delay 90% of the time
With Timecard
Without Timecard
Target delay
![Page 72: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/72.jpg)
• Mobile ads service• Twitter analysis service
Deployment
![Page 73: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/73.jpg)
Twitter Analysis Service
Fetch from Twitter and analyze
Get keyword Parse and renderSend keywordScore and tweets
![Page 74: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/74.jpg)
Twitter Analysis Service
Fetch from Twitter and analyze
Get keyword Parse and renderSend keywordScore and tweets
![Page 75: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/75.jpg)
Twitter Analysis ServiceGetElapsedTime(
); PredictRemainingTime(responseSize);
Adapt Processing Time
Adapt Response
Get keyword Parse and renderSend keywordScore and tweets
10KB to 50 KB
![Page 76: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/76.jpg)
Twitter Analysis Service• ~150,000 transactions• Adapt server processing time in steps of 150ms
With Timecard
Without Timecard
Target delay
Tightly control end-to-end delay with Timecard
![Page 77: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/77.jpg)
• 0.1% runtime overhead
• Less than 1% memory overhead
• Less than 1% network overhead
• Negligible battery overhead
Timecard Overhead
![Page 78: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/78.jpg)
Limitations
• Bootstrapping– Training the downlink and app processing delay predictors– Learn app processing delay for every transaction type– Turn off adaptation till enough data is collected
• Complex transactions– Multiple parallel or serial requests– Elapsed time will work!– Need to model complex interactions or need developer help
![Page 79: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/79.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Adapt Processing Time
Adapt Response
End-to-end deadline
![Page 80: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/80.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Adapt Resources Used
End-to-end deadline
![Page 81: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/81.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);Request Prioritization
End-to-end deadline
![Page 82: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/82.jpg)
Timecard
GetElapsedTime();
PredictRemainingTime(responseSize);
Deadlines
Scheduler
![Page 83: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/83.jpg)
• Controlling end-to-end delays– Elapsed time– Prediction on remaining time
• Can be applied in several context
Take-Away
Adapt quality of the paper
SOSP Deadline
GetElapsedTime();
PredictRemainingTime(paper);
![Page 84: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/84.jpg)
Timecard
App App
Server
GetElapsedTime(); PredictRemainingTi
me(responseSize);
Time elapsed since user interaction
Predicted downlink & app processing delay
![Page 85: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/85.jpg)
Backup
![Page 86: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/86.jpg)
Predicting App Processing Delay
AppResponse size
• Correlated with response size
Analysis of AppInsight data 1653 types of transactions
Response size (KB)
Proc
essin
g de
lay
(ms)
![Page 87: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/87.jpg)
Predicting App Processing Delay
AppResponse size• Parsing delay
– Correlated with data size• Rendering delay– Correlated with data size
• Dependent on device type– Processing speed
• Correlated with response size
Analysis of AppInsight data 1653 types of transactions
![Page 88: Timecard : Controlling User-Perceived Delays in Server-Based Mobile Applications](https://reader031.vdocuments.us/reader031/viewer/2022013004/56816468550346895dd6534e/html5/thumbnails/88.jpg)
Predicting App Processing Delay
App
PredictRemainingTime(responseSize);
Processing Delay Predictor
Learn
• Decision tree model– Response size– Device type
Analysis of AppInsight data 1653 types of transactions
Median error - 8ms90th percentile error - 100ms