Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it...
-
Upload
bethanie-curtis -
Category
Documents
-
view
214 -
download
0
Transcript of Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it...
![Page 1: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/1.jpg)
Improving and Controlling User-Perceived Delays in Mobile Apps
Lenin Ravindranath
By the time it loads, the church service is over. Too slow!!!
Slow responsiveness, long load time.
So slow. Did an intern write this app??
Slower than a snail.
horrifically slow.Uninstalled.
MIT
So slow that my screen already dims before it's loaded
![Page 2: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/2.jpg)
![Page 3: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/3.jpg)
![Page 4: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/4.jpg)
~ Two Million Apps
> 500,000 Developers
![Page 5: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/5.jpg)
Too slow - killing the usefulness when you really need to go
There’s an App for that
But it’s slow
![Page 6: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/6.jpg)
“So slow. Did an intern write this app??”
“Slower than a snail even on 3G.”
“Slow and unresponsive like mud”
“Sluggish and freezes my HTC phone.”
“Very very slow compared to even browsing web.”
“Consistently 3 seconds behind where I touch.”
“Loading GPS data is *** slow”
![Page 7: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/7.jpg)
• Diverse environmental conditions– Network connectivity, GPS signal quality,– Location, Sensor conditions etc.
• Variety of hardware and OS versions• Wide range of user interactions and inputs
Hard for developers to test
Performance problems are inevitable in the wild
Significant diversity in the wild
![Page 8: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/8.jpg)
• App store is brutally competitive
Need for improving and controlling performance
• Response time matters– Users are impatient– 100ms delay can cost substantial drop in revenue at Amazon– Similar observations from Google and Bing
Help app developers
![Page 9: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/9.jpg)
Find a bar
![Page 10: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/10.jpg)
User Interaction Rendering
User-perceived delay
Monitor in the hands of user
Improve and control the user-perceived delay
![Page 11: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/11.jpg)
User Interaction Rendering
AppInsightOSDI ‘12
Monitor performance in the wild
What is the user-perceived delay?
Where is the bottleneck?
Developer
Feedback
• Users with slow network – Poor Performance
• Users with fast network – Not producing the best quality result
![Page 12: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/12.jpg)
User Interaction Rendering
AppInsightOSDI ‘12
Monitor performance in the wild
What is the user-perceived delay?
Where is the bottleneck?
Developer
Feedback
Deal with uncontrolled variability
![Page 13: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/13.jpg)
User Interaction Rendering
AppInsightOSDI ‘12
Monitor performance in the wild
What is the user-perceived delay?
Where is the bottleneck?
Developer
Feedback
TimecardSOSP ‘13
Adapt processing to conditions in the wild
How much time has already been spent?
How much time will be spent?
RuntimeEstimatio
n
Adapt
High delays High delaysReduce
Tightly control user-perceived delay
![Page 14: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/14.jpg)
User Interaction Rendering
AppInsightOSDI ‘12
Monitor performance in the wild
What is the user-perceived delay?
Where is the bottleneck?
Developer
Feedback
TimecardSOSP ‘13
Adapt processing to conditions in the wild
How much time has already been spent?
How much time will be spent?
RuntimeEstimatio
n
Adapt
Tightly control user-perceived delay
Low delays Low delaysImprove result
![Page 15: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/15.jpg)
User Interaction Rendering
AppInsightOSDI ‘12
Monitor performance in the wild
What is the user-perceived delay?
Where is the bottleneck?
Developer
Feedback
TimecardSOSP ‘13
Adapt processing to conditions in the wild
How much time will be spent?
RuntimeEstimatio
n
How much time has already been spent?
![Page 16: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/16.jpg)
AppInsight
Timecard
Minimal developer effort Readily deployable
- No changes to the OS or runtime
Negligible overhead
Product Impact at Microsoft, Facebook
Used by dozens of developers
![Page 17: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/17.jpg)
AppInsight
Timecard
App
AppInstrumented
Automatic Binary
Instrumentation
User Transaction
TrackingMonitor app execution across async boundariesin a light-weight manner
![Page 18: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/18.jpg)
AppInsight Monitor performance in the wild
What is the user-perceived delay?
Where is the bottleneck?
Developer
Feedback
Significant barrier for most app developers
• No platform support• Only option is to instrument your app– Manage your own logging infrastructure
![Page 19: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/19.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
Performance
Improved
Developer
AppInsight
AppStore
![Page 20: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/20.jpg)
• Highly interactive, UI centric– Single UI thread that should not be blocked
• Most tasks are performed asynchronously– Asynchronous APIs for Network, Sensor, IO etc.– Computation performed on background threads
Highly Asynchronous Programming Pattern
Monitoring App Performance is Challenging
Tracing async code is challenging
![Page 21: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/21.jpg)
Internet
Location
Mood Around Me
Nearby Tweets
GPS
sad
“Just got engaged :)”
“My life sucks”
“At last its sunny. But I have to sit and prepare my talk :(”
“I am sad that there is no more how I met your mother”
![Page 22: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/22.jpg)
ClickHandler() { location = GPS.Sample(); url = GetUrl(location) tweets = Http.Get(url); result = Process(tweets); UI.Display(result);
}
GetUrl(location){ ... }
Process(tweets){ ... }
ClickHandlerStart
ClickHandlerEnd
LogStart();
LogEnd();
Thread
User-perceived Delay
Hypothetical Synchronous Code
User Interaction
Mood Around Me
sad
![Page 23: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/23.jpg)
ClickHandler() { GPS.AsyncSample(GPSCallback);}
GPSCallback(location) { url = GetUrl(location); Http.AsyncGet(url, DownloadCallback);}
DownloadCallback(tweets) { result = Process(tweets); UI.Dispatch(Render, result);}
Render(result){ UI.Display(result);}
GetUrl(location){ ... }
Process(tweets){ ... }
Render
UI Thread
Background Thread
UI Dispatch
ClickHandlerStart
System
ProcessDownloadCallback
User Interaction
Asynchronous Code
Background Thread
GPS
Network
ClickHandlerEnd
Async Http CallAsync GPS Call
GPSCallback
![Page 24: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/24.jpg)
Render
UI Thread
UI Dispatch
ClickHandlerStart
System
Async GPS Call
DownloadCallback
User Interaction
Background Thread
Network
Async Http Call
GPSCallback
GPS
Background Thread
User Transaction
Transaction timeUser-perceived Delay
![Page 25: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/25.jpg)
UI Thread
Background Thread
Background Thread
User Transaction
![Page 26: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/26.jpg)
Apps are highly asynchronous
Where is the bottleneck?Focus development efforts
30 popular apps200,000 transactions
– On average, 10 asynchronous calls per user transaction
Up to 7000 edges
– There are apps with 8 parallel threads per transaction
![Page 27: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/27.jpg)
UI Thread
Background Thread
Background Thread
Background Thread
Thread Wakeup
Thread Blocked
Fire
Fire
Render
Callback
Callback
Nearby Tweets
Nearby PostsTwitter
Facebook Process Posts
Process Tweets
User Interaction
Aggregate
GPS
GPS Callback
Mood Around Me
![Page 28: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/28.jpg)
UI Thread
Background Thread
Background Thread
Background Thread
Thread Wakeup
Thread Blocked
Fire
Fire
RenderUser TransactionUser Interaction
Aggregate
GPS
GPS Callback
Critical PathOptimizing the critical path reduces the user perceived delay
CallbackFacebook
CallbackTwitter
FacebookProcess Posts
Process Tweets
![Page 29: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/29.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
Developer
AppInsight
AppStore
![Page 30: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/30.jpg)
Low Overhead
Capturing User Transactions
UI Thread
Background Thread
Background Thread
User Transaction
Instrumentation impacts app performance– They are already slow enough!!!
Scarce Resources– Compute, Memory, Network, Battery
![Page 31: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/31.jpg)
• User InteractionsCapture
UI Thread
Background Thread
Background Thread
User Transaction
User Interaction
Event Handler
![Page 32: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/32.jpg)
• User Interactions• Thread Execution
Capture
UI Thread
Background Thread
Background Thread
User Transaction
ClickHandlerStart
ClickHandlerEnd
RenderStart
DownloadCallback Start
End
GPSCallback Start
GPSCallback End
RenderEnd
![Page 33: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/33.jpg)
• User Interactions• Thread Execution• Async Calls and Callbacks
Capture
UI Thread
Background Thread
Background Thread
User Transaction
UI Dispatch Call
Download Callback
Async GPS Call
GPS Callback
Async Http Call
UI DispatcherCallback
![Page 34: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/34.jpg)
• User Interactions• Thread Execution• Async Calls and Callbacks• UI Updates
Capture
UI Thread
Background Thread
Background Thread
User Transaction
UI Update
![Page 35: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/35.jpg)
UI Thread
Background Thread
Background Thread
Background Thread
• User Interactions• Thread Execution• Async Calls and Callbacks• UI Updates• Thread Synchronization
Fire
Fire
Thread Blocked Thread Wakeup
Capture
User Transaction
![Page 36: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/36.jpg)
• User Interactions• Thread Execution• Async Calls and Callbacks• UI Updates• Thread Synchronization
Capture
UI Thread
Background Thread
Background Thread
User Transaction
![Page 37: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/37.jpg)
• Trace every method– Prohibitive overhead
• Enough to log thread boundaries• Log entry and exit of Upcalls
Capturing Thread Execution
Upcalls
System
App
UI Thread
Background Thread
Background Thread
ClickHandlerStart
ClickHandlerEnd
RenderStart
End
GPSCallback Start
GPSCallback End
RenderEnd
DownloadCallback Start
![Page 38: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/38.jpg)
ClickHandler() { GPS.AsyncSample(GPSCallback);}GPSCallback(location) { url = GetUrl(location); Http.AsyncGet(url, DownloadCallback);}DownloadCallback(tweets) { result = Process(tweets); UI.Dispatch(Render, result);}Render(result){ UI.Display(result);}
• Event Handlers are Upcalls• Function pointers point to potential Upcalls
– Callbacks are passed as function pointers
<Button Click=“ClickHandler” />
Identify Upcalls
![Page 39: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/39.jpg)
Instrument Upcalls• Rewrite app
– Trace Upcalls
ClickHandler() { Logger.UpcallStart(1); GPS.AsyncSample(GPSCallback); Logger.UpcallEnd(1);}
GPSCallback(location) { Logger.UpcallStart(2); url = GetUrl(location); Http.AsyncGet(url, DownloadCallback); Logger.UpcallEnd(2);}
DownloadCallback(tweets){ Logger.UpcallStart(3); result = Process(tweets); UI.Dispatch(Render, result); Logger.UpcallEnd(3);}
Render(result){ Logger.UpcallStart(4); UI.Display(result); Logger.UpcallEnd(4);}
GetUrl(location){ ... }
Process(tweets){ ... }
UI Thread
Background Thread
Background Thread
ClickHandlerStart
ClickHandlerEnd
RenderStart
DownloadCallback Start
End
GPSCallback Start
GPSCallback End
RenderEnd
Low Overhead
7000 times less overhead
![Page 40: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/40.jpg)
UI Thread
Background Thread
Background Thread
UI Dispatch Call
Download Callback
Async GPS Call
GPS Callback
Async Http Call
UI DispatcherCallback
Async Calls and Callbacks
![Page 41: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/41.jpg)
Async Calls and Callbacks• Log Callback Start
– We capture start of the thread
• Log Async Call
• Match Async Call to its Callback
GPSCallback(location) { Http.AsyncGet(url, DownloadCallback); Logger.AsyncCall(5);}
DownloadCallback(tweets) { Logger.UpcallStart(3); ....}
Download Callback
Async Http Call
Detour Callbacks
![Page 42: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/42.jpg)
System
App
Http.AsyncGet
Async Call
DownloadCallback
DownloadCallback(tweets){}
Callbacks
![Page 43: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/43.jpg)
Detour Callbacks
DetourCallback(tweets){
DownloadCallback(tweets);}
class DetourObject {
}
MatchId = 3
obj.DetourCallback
MatchId = 3
MatchId = 3
Http.AsyncGet(url, DownloadCallback); Http.AsyncGet(url, obj.DetourCallback);
obj = new DetourObject(DownloadCallback, MatchId++);
System
App
Http.AsyncGet
Async Call
DownloadCallback
DownloadCallback(tweets){}
while(...) {
}
![Page 44: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/44.jpg)
Detour Callbacks
DetourCallback(tweets){
DownloadCallback(tweets);}
class DetourObject {
}
MatchId = 4
obj.DetourCallback
MatchId = 4
MatchId = 4
obj = new DetourObject(DownloadCallback, MatchId++);
System
App
Http.AsyncGet
Async CallDownloadCallback(tweets){}
while(...) {
}
Http.AsyncGet(url, obj.DetourCallback);
![Page 45: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/45.jpg)
Detour Callbacks
DetourCallback(tweets){
DownloadCallback(tweets);}
class DetourObject {
}
MatchId = 5
obj.DetourCallback
MatchId = 5
MatchId = 5
obj = new DetourObject(DownloadCallback, MatchId++);
System
App
Http.AsyncGet
Async CallDownloadCallback(tweets){}
while(...) {
}
Http.AsyncGet(url, obj.DetourCallback);
![Page 46: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/46.jpg)
• Detour Callbacks• Delayed Callbacks– Track Object Ids
• Event Subscriptions
Async Calls and Callbacks
Low Overhead
![Page 47: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/47.jpg)
• User Interactions• Thread Execution• Async Calls and Callbacks• UI Updates• Thread Synchronization
Capture
UI Thread
Background Thread
Background Thread
User Transaction
![Page 48: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/48.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
Developer
AppInsight
AppStore
![Page 49: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/49.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
Developer
AppInsight
AppStore
![Page 50: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/50.jpg)
Aggregate Analysis
Group similar transactions– Same transaction graph
• Outliers– Points to corner cases
• Highlight common critical paths– Focus development effort
• Root causes of performance variability– Highlight what really matters in the wild
Async GPS Call Async Http Call
Network
GPS
Device
Compute
![Page 51: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/51.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
Developer
AppInsight
AppStore
![Page 52: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/52.jpg)
Developer FeedbackWeb based Interface
• Long User Transactions• Critical Path• Aggregate Analysis– Outliers– Common Case– Factors affecting
![Page 53: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/53.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
Developer
Deployment
AppInsight
AppStore
![Page 54: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/54.jpg)
Deployment
• 40 apps in the Windows Phone store• 30 to few thousand users• 6 months to 1 year of data• > Million user transactions
![Page 55: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/55.jpg)
AppInsight Overhead
Battery
<1%
Binary Size
1.2%
Memory
2%
Network
4%
Compute
0.02%
Low Overhead
• Impact on app performance is minimal• Low resource consumption
Based on 6 months of data from 30 apps in the wild
![Page 56: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/56.jpg)
User Transactions and Critical Path
• 15% of the user transactions took more than 5 seconds!– 30% took more than 2 seconds
• Top 2 edges responsible for 82% of transaction time
• Critical path analysis– Focus on less than half the edges for 40% of transactions
• Aggregate analysis – Pointed to factors creating performance variability– GPS, Device, Network, Sensors
Focus development efforts
![Page 57: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/57.jpg)
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
AppInsight
Developer
Improved
Users
AppStore
![Page 58: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/58.jpg)
App: My App
Problem: UI hog
AppInsight:• High performance variability in UI thread• Abnormal latencies only at the start of the session• System loading DLLs in the critical path– Up to 1 second
Fix:• Preload the DLL asynchronously when the app starts– Dummy call to DLL
Developer Case Study
![Page 59: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/59.jpg)
App: Popular Search App
Problem: Radio wakeup delay
AppInsight:• High performance variability before network call• Radio wakeup delay in critical path• Dominating when users are on cellular networks– More than 2 seconds
Fix:Wakeup radio as the user starts typing before invoking the transaction
Developer Case Study
![Page 60: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/60.jpg)
Developer Case Study
App: Popular Professional App
Problem: Slow transactions
AppInsight:• Custom instrumentation in the critical path– Affecting user perceived delay
![Page 61: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/61.jpg)
Users
App
Instrumenter
AppInstrumented
Analysis
Developer
Feedback
Server
Traces
AppInsight
Developer
AppStore
![Page 62: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/62.jpg)
Server-based User Transactions
Core processing of the user transaction is at the serverCore processing
Server
Input and sensors
User Interaction
App
Send request
NetworkParse and
renderReceiveresponse
App
Network
![Page 63: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/63.jpg)
GPS Start
Http Request
GPS Callback
ClickHandler
UI Dispatcher
Download Callback
Server
Network + Server
• Joint app-server instrumentation– Azure services
Server-based User Transactions
Request Handler Start Request Handler End
Network Network
![Page 64: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/64.jpg)
Server Threads
Spawn Workers
Send ResponseRequest Handler
GPS Start
Http RequestClick
Handler
Download CallbackGPS Callback
UI Dispatcher
Server-based User Transactions
Identify and fix bottlenecks at the app and the server
Network
Server
NetworkHTTP[“x-AppInsight-Id”]
![Page 65: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/65.jpg)
Server
User Interaction Rendering
App App
NetworkNetwork
Uncontrollable and Variable Delays
Reading sensors
Radio state
Device type
(3G, 4G, WiFi, LTE, ..)RTT, tput, TCP, DNS
Device type
![Page 66: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/66.jpg)
Server
User Interaction Rendering
App App
NetworkNetwork
Uncontrollable and Variable Delays
Reading sensors
Radio state
Device type
(3G, 4G, WiFi, LTE, ..)RTT, tput, TCP, DNS
Device type
Significant variability in user-perceived delays
![Page 67: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/67.jpg)
Server
User Interaction Rendering
App App
NetworkNetwork
Uncontrollable and Variable Delays
Reading sensors
Radio state
Device type
(3G, 4G, WiFi, LTE, ..)RTT, tput, TCP, DNS
Device type
Significant variability in user-perceived delays
• Users with high uncontrollable delays– Poor user-perceived delays
• Users with low uncontrollable delays– Not producing the best quality result
![Page 68: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/68.jpg)
Server
User Interaction Rendering
App App
NetworkNetwork
Uncontrollable and Variable Delays
Reading sensors
Radio state
Device type
(3G, 4G, WiFi, LTE, ..)RTT, tput, TCP, DNS
Device type
Tightly control user-perceived delays
Adapt to conditions in the wild
![Page 69: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/69.jpg)
Server
User Interaction Rendering
App App
NetworkNetwork
Adapt to conditions in the wild
AdaptDo less or more processing
Send less or more data
Meet end-to-end deadline
Trade-off on quality or quantity of the result
Tightly control user-perceived delays
![Page 70: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/70.jpg)
Request Response
Deadline
Server processing
• Trade-off quality of result for processing time– More time to process, better quality results
Server
Controlling the Server Delay
![Page 71: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/71.jpg)
Request Response
Deadline
WorkerWorker
Worker
Worker
Worker
Server
Controlling the Server Delay
![Page 72: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/72.jpg)
Request Response
Deadline
WorkerWorker
Worker
Worker
Worker
Better result
Server
Controlling the Server Delay
![Page 73: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/73.jpg)
Deadline
Server
Server processing
Controlling the Server Delay
• Servers keep fixed deadlines– No visibility into external delays
![Page 74: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/74.jpg)
Server
User Interaction Rendering
App App
NetworkNetwork
Adapt to conditions in the wild
Tightly control user-perceived delays
Adapt
![Page 75: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/75.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Time elapsed since user interaction
Predicted downlink & app processing delay
![Page 76: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/76.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Adapt Processing Time
Desired user-perceived delay
![Page 77: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/77.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Adapt Processing Time
Trade-off on quality of the result
Desired user-perceived delay
![Page 78: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/78.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Adapt Response
PredictRemainingTime(10KB);
PredictRemainingTime(5KB)
PredictRemainingTime(15KB);
Desired user-perceived delay
![Page 79: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/79.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Adapt Response
Desired user-perceived delay
![Page 80: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/80.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Better quality result
Desired user-perceived delay
![Page 81: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/81.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
• Analysis of 4000 apps– 80% of them are single request-response transactions
![Page 82: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/82.jpg)
Challenges
Server
App App
![Page 83: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/83.jpg)
Challenges
UI Thread
Background Thread
GPS Start
Http RequestGPS Callback
ClickHandler
Server
App
UI Dispatcher
Download Callback
AppHighly asynchronous
![Page 84: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/84.jpg)
Server Threads
Challenges
Spawn Workers
Send Response
ServerRequest Handler
UI Thread
Background Thread
GPS Start
Http RequestGPS Callback
ClickHandler
App
UI Dispatcher
Download Callback
AppHighly asynchronous
![Page 85: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/85.jpg)
Challenges
Server
App App
GetElapsedTime();
No single reference clock
Variable network delaysand processing delays
PredictRemainingTime(responseSize);
Transaction
Highly asynchronous
![Page 86: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/86.jpg)
Timecard
Server
App App
GetElapsedTime();
PredictRemainingTime(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 87: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/87.jpg)
Timecard
App Instrument
er
Service
Developer
Timecard.dll
GetElapsedTime();
PredictRemainingTime(responseSize);
Desired user-perceived delay
App
AppInstrumented
AppStore
![Page 88: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/88.jpg)
Timecard
Server
App App
GetElapsedTime();
PredictRemainingTime(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 89: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/89.jpg)
Server Threads
Spawn Workers
Send Response
ServerRequest Handler
Transaction
UI Thread
Background Thread
GPS Start
Http RequestGPS Callback
ClickHandler
App
UI Dispatcher
Download Callback
App
Transaction Tracking
![Page 90: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/90.jpg)
Server Threads
Spawn Workers
Send Response
ServerRequest Handler
UI Thread
Background Thread
GPS Start
Http RequestGPS Callback
ClickHandler
App
UI Dispatcher
Download Callback
App
Transaction Tracking
TC Transaction context (TC) attached to every thread
– Carry along timestamps, transaction information
TC
TC
TC
TC
TC
TC
TC
TC
GetElapsedTime();
![Page 91: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/91.jpg)
Timecard
Server
App App
GetElapsedTime();
PredictRemainingTime(responseSize);
Transaction
Transaction Tracking
TimeSync Delay Predictors
![Page 92: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/92.jpg)
TimeSync
GPS
• Sync with Cell Tower– Off my several seconds to minutes
• GPS– Does not work indoors
• Probing
Probe
![Page 93: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/93.jpg)
• Typical probing techniques don’t work well– Radio wakeup delays and queuing delays– Errors more than 100ms – Energy inefficient (network radio tail energy)
TimeSync
• Radio-aware, network-aware probing– Probes when radio is active and network is idle
![Page 94: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/94.jpg)
TimeSync in Timecard
Server
App App
![Page 95: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/95.jpg)
TimeSync in Timecard
Probe
UI Thread
Background Thread
GPS Start
Http RequestGPS Callback
ClickHandler
App
~5ms errorEnergy efficient
![Page 96: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/96.jpg)
Timecard
App App
Server
GetElapsedTime();
Time elapsed since user interaction
![Page 97: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/97.jpg)
Predicting Remaining Time
App App
Server
PredictRemainingTime(responseSize);
Downlink delay App processing delay
![Page 98: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/98.jpg)
Predicting Downlink Delay
LatencyThroughput
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
Response size
![Page 99: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/99.jpg)
Predicting Downlink Delay
TCP Window
1 extra RTT
![Page 100: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/100.jpg)
Predicting Downlink Delay
Response sizeLatency
TCP parameters
Determined by RTT Number of round trips
![Page 101: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/101.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 102: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/102.jpg)
Predicting Downlink DelayPredictRemainingTime(responseSize);• Data-driven 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
Cellular Median error - 17 ms, 90th percentile - 86 ms
Wi-Fi Median error - 12 ms, 90th percentile - 31ms
Learn
![Page 103: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/103.jpg)
Predicting App Processing Delay
App App
Server
PredictRemainingTime(responseSize);
• Parsing and rendering delay– Correlated with response size– Correlated with device type
![Page 104: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/104.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Time elapsed since user interaction
Predicted downlink & app processing delay
![Page 105: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/105.jpg)
Mobile Ads ServiceContextual ads to mobile apps
![Page 106: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/106.jpg)
Mobile Ads Service
Fetch and process ads for keywords
Extract keywords Render adSend keywords
Ad
![Page 107: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/107.jpg)
Mobile Ads Service
Extract keywords Render adSend keywords
Ad
Ad providerAd provider
Ad provider
Ad provider
Ad provider
A
Keywords
![Page 108: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/108.jpg)
Mobile Ads Service
Extract keywords Render adSend keywords
Ad
![Page 109: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/109.jpg)
Mobile Ads Service
Extract keywords Render adSend keywords
Ad
GetElapsedTime();
PredictRemainingTime(responseSize);
Adapt Processing Time
![Page 110: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/110.jpg)
Mobile Ads Service
Within 50ms of the target delay 90% of the time
With Timecard
Without Timecard
Target delay
User-perceived delay (ms)
• ~200,000 transactions
![Page 111: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/111.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Adapt Resources Used
Desired user-perceived delay
![Page 112: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/112.jpg)
Timecard
App App
Server
GetElapsedTime();
PredictRemainingTime(responseSize);
Request Prioritization
![Page 113: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/113.jpg)
AppInsight
Timecard
Identify performance bottleneckso Critical path analysis
Control user-perceived delayso Elapsed time estimationo Remaining time prediction
User transaction trackingo Asynchrony, Time Sync
![Page 114: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/114.jpg)
By the time it loads, the church service is over. Too slow!!!
Slow responsiveness, long load time, and crashity crash crash.
horrifically slow.Uninstalled.
Crashes every time. DO NOT DOWNLOAD. RIP-OFF!!
Slow and Crashes often. Fix. I will give 5 stars instead of 1.
So slow that my screen already dims before it's loaded
Too slow - killing the usefulness when you really need to go
Crashes all the time. Should be called Crashing News.
Crashed 3 times before I gave up
Slow or no network crashes the app immediately.
![Page 115: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/115.jpg)
UI Thread
Background Thread
Background Thread
Exceptionat GetSentiment()DownloadCallback()
Stack trace
GetSentiment()……DownloadCallback()
Http.AsyncGet(url)
GPSCallback()
ClickHandler()
GPS.AsyncSample()
User Interaction
Exception Path
App Crashes
App Store
Slow and Crashes often. DO NOT DOWNLOAD. RIP-OFF!!
![Page 116: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/116.jpg)
VanarSena MobiSys ‘13
• Fast UI automation– Based on transaction tracking– 4x - 40x reduction in testing time
Scalable Testing Infrastructure
• Automatic dynamic testing – Using an army of monkeys
Uncovered ~3000 crash bugs in 1100 apps in the app store
![Page 117: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/117.jpg)
Apps
OS
Sensors Network
VanarSenaMobiSys ‘14
AppInsightOSDI ‘12
TimecardSOSP ‘13
ProcrastinatorMobiSys ‘14
Wireless ESP
NSDI ‘11
VTrackSenSys ‘09
CTrackNSDI ‘11
SmartAdsMobiSys ‘13
CodeInTheAir
HotMobile ‘12
CombineMobiSys ‘07
SixthSense
MobiSys ‘08
DAIRMobiSys ‘06
App—aware Operating Systems
NectarOSDI ‘10
Wearables
Mobile Support
Best Paper
Best Paper Nominee
![Page 118: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/118.jpg)
Backup
![Page 119: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/119.jpg)
• 0.1% runtime overhead
• Less than 1% memory overhead
• Less than 1% network overhead
• Negligible battery overhead
Timecard Overhead
![Page 120: Improving and Controlling User-Perceived Delays in Mobile Apps Lenin Ravindranath By the time it loads, the church service is over. Too slow!!! Slow responsiveness,](https://reader035.fdocuments.in/reader035/viewer/2022062519/5697bfd21a28abf838cabb65/html5/thumbnails/120.jpg)