end-to-end performance analytics for mobile apps

37
End-to-End Performance Analytics For Mobile Apps Lenin Ravindranath, Jitu Padhye, Ratul Mahajan Microsoft Research 1

Upload: anise

Post on 12-Feb-2016

32 views

Category:

Documents


0 download

DESCRIPTION

End-to-End Performance Analytics For Mobile Apps. Lenin Ravindranath, Jitu Padhye, Ratul Mahajan Microsoft Research. Apps are Slow. “So slow . Did an intern write this app ??”. “Slower than a snail .”. “Slow and unresponsive like mud”. “Sluggish and freezes my HTC phone.”. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: End-to-End Performance Analytics For Mobile Apps

1

End-to-End Performance Analytics For Mobile Apps

Lenin Ravindranath, Jitu Padhye, Ratul MahajanMicrosoft Research

Page 2: End-to-End Performance Analytics For Mobile Apps

2

“Slower than a snail.”

“Slow and unresponsive like mud”

“Consistently 3 seconds behind where I touch.”

“So slow. Did an intern write this app??”

“Very very slow compared to even browsing web.”

“Sluggish and freezes my HTC phone.”

Apps are Slow

Page 3: End-to-End Performance Analytics For Mobile Apps

3

CloudServices

MobileApps

Most Mobile Apps talk to the Cloud

Page 4: End-to-End Performance Analytics For Mobile Apps

4

Cloud Service

Location

Restaurants

Page 5: End-to-End Performance Analytics For Mobile Apps

5

AppInsight

App

AppInstrumented

Instrumenter

ClickHandler() { [Instrument] LocationStart(LocationCallback);}

LocationCallback(location) { [Instrument] url = GetRequestUrl(location); [Instrument] WebRequest(url, WebResponseCallback);}

WebResponseCallback(data) { [Instrument] list = ParseData(data); [Instrument] UIDispatch(Display, list);}

Display(list){ [Instrument] UIListBox.DataContext = list;}

Automatic Instrumentation

Page 6: End-to-End Performance Analytics For Mobile Apps

6

AppInsight

User click

Web Request Web Response

Web Requestdelay

User Perceived Delay

GPSdelay

Parsing and Renderingdelay

Page 7: End-to-End Performance Analytics For Mobile Apps

7

AppInsight

User click

Web Request Web Response

User Perceived Delay

Where is the bottleneck?

Network? Server?DB?Uplink? Downlink?

Page 8: End-to-End Performance Analytics For Mobile Apps

8

End-to-End Insight

User click

Web Request Web Response

User Perceived Delay

Server

Uplinkdelay

Downlinkdelay

Serverdelay

Query Processingdelay

DB

GPSdelay

Parsing and Renderingdelay

Page 9: End-to-End Performance Analytics For Mobile Apps

9

EndInsight

• Joint App and Server Instrumentation– Windows Phone Apps, ASP .NET Services– Automatic Instrumentation– Zero developer effort– Binary Instrumentation

• Readily deployable– No changes to the OS, runtime or platform

• Low overhead

Page 10: End-to-End Performance Analytics For Mobile Apps

10

App

App Instrument

er

InstrumentedApp

Service Instrumente

r

Service

InstrumentedService

Developer

Cloud

App Store

Analysis Server

Developer Feedback

Traces

Traces

Downloads

Page 11: End-to-End Performance Analytics For Mobile Apps

11

App Instrumentation

User click

Web Request Web Response

Web RequestdelayGPS

delayParsing and Rendering

delay

Using AppInsight

Page 12: End-to-End Performance Analytics For Mobile Apps

12

AppInsight Recap• Track User Transactions– From user click to UI rendering

• Across asynchronous thread boundaries

• Automatically track– UI manipulation– Threads, asynchronous calls– Web calls, Sensor APIs– UI update (dispatcher events)

User request UI Update

UI Thread

Background thread

GPS fix Callback

UI dispatch

Background thread

Web Request

Response Callback

App

GPS Start

Page 13: End-to-End Performance Analytics For Mobile Apps

13

Server Instrumentation• Automatic Instrumentation of .NET binaries• Azure services– Web APIs, ASPX pages, MVC, WCF

• Automatically track– Request-Response entry points– DB queries– Network calls

• Across asynchronous boundaries– Similar to app instrumentation

class AroundMeController: ApiController{

public Result Get(type, location) { [Instrument] return GetList(type, location); [Instrument]}

public Result GetList(type, location) { [Instrument] result = DBQuery(type, location); [Instrument] return result;}

}

Page 14: End-to-End Performance Analytics For Mobile Apps

14

Server InstrumentationServerdelay

Query Processingdelay

DB

Request Response

Request Processing Delay

Page 15: End-to-End Performance Analytics For Mobile Apps

15

Putting them together?

Serverdelay

Query Processingdelay

DB

Request Response

Web Request Web Response

App Performance

Server Performance

Page 16: End-to-End Performance Analytics For Mobile Apps

16

Matching App and Server Traces

• Pass a Unique Id from App to Server• Add a new HTTP header in web requests– x-EndInsight-Id

• App Instrumentation– Instrument HTTP request calls– Generate unique Id when app makes a web request– Add x-EndInsight-Id header in web requests

• Server Instrumentation– Log the unique id and remove the extra header at the request

entry point

Page 17: End-to-End Performance Analytics For Mobile Apps

17

Matching App and Server Traces

User click

Web Request Web Response

Server

DB

Add header[x-EndInsight-Id] = “59bc73e4-9251-4618-97a7-41ac86c6c039”

Log and Remove header[x-EndInsight-Id]

Page 18: End-to-End Performance Analytics For Mobile Apps

18

DB

Request Response

Web Request Web Response

Finding Network Delays

Server Request Processing Delay

App Web Request Delay

Network Delay = [App Web Request Delay] – [Server Request Processing Delay]

Page 19: End-to-End Performance Analytics For Mobile Apps

19

Separating Uplink and Downlink Delays

Server

Uplinkdelay

Downlinkdelay

DB

Requires knowing the clock offset and driftbetween Client and Server

Different Clocks

Timestamp

Timestamp

Page 20: End-to-End Performance Analytics For Mobile Apps

20

Finding Clock Offset and DriftNTP-like TechniqueProbes from client timestamped by the server

Timestamp ts Timestamp te

Timestamp s

Clock Offset = s – ((ts + te) / 2) Clock Drift = Slope of linear regression of many such probes

More probes, better estimate

Page 21: End-to-End Performance Analytics For Mobile Apps

21

• Automatic Instrumentation of App– To send periodic probes to server

• Automatic Instrumentation of Server– Open up API to timestamp probes

Probing

• Efficient technique for probing– Aware of the radio state and traffic– Minimal extra delays– Energy efficient

Page 22: End-to-End Performance Analytics For Mobile Apps

22

Network Delays• Uplink– DNS– Connection setup

• Downlink

Analysis

App Delays• App processing• Sensor processing• Parsing/Rendering• Radio wakeup• Disk access

Server Delays• Server Processing• Query Processing

Automatic analysis of end-to-end transaction delays

Page 23: End-to-End Performance Analytics For Mobile Apps

23

Critical Path Analysis

Page 24: End-to-End Performance Analytics For Mobile Apps

24

Group similar transactions

• Outliers– Points to corner cases

• Highlight common critical paths– Focus development effort

• Root causes of Performance Variability– Highlight factors affecting performance

Aggregate Analysis

Page 25: End-to-End Performance Analytics For Mobile Apps

25

Web based Interface

Developer Feedback

Page 26: End-to-End Performance Analytics For Mobile Apps

26

Compute NetworkMemory Battery

low2% 4%<0.1%

• Impact on app and server performance is minimal• Low resource consumption

EndInsight Overhead

Page 27: End-to-End Performance Analytics For Mobile Apps

27

Timecard: Controlling End-to-End Delays

Page 28: End-to-End Performance Analytics For Mobile Apps

28

Servers Control Variability in Response Times

Request Response

• Fixed deadlines• Trade-off quality for response time– More time to compute, better quality results– Flexible Services

Deadline

Server processing

Page 29: End-to-End Performance Analytics For Mobile Apps

29

The elephant is outside the room

Request Response

Server processing

Page 30: End-to-End Performance Analytics For Mobile Apps

30

The elephant is outside the room

User click

Server processing

App App

ServerRequest Response

Uplink Downlink

Page 31: End-to-End Performance Analytics For Mobile Apps

31

• Unaware of end-to-end delays• Clients with non-trivial external delays– Poor end-to-end response times

• Client with minimal external delays– Do not produce the best quality result

• Could adapt differently for different users

Servers have no visibility into delays outside

Page 32: End-to-End Performance Analytics For Mobile Apps

32

TimecardGetElapsedTime(); PredictDownstreamTime

(responseSize);

Time elapsed since user request

Predicted downlink + app processing delay

App App

Server

Page 33: End-to-End Performance Analytics For Mobile Apps

33

Timecard

App App

Server

Desired end-to-end delay

App

GetElapsedTime(); PredictDownstreamTime(responseSize);

Adapt Processing Time

Page 34: End-to-End Performance Analytics For Mobile Apps

34

Timecard

App

Server

Desired end-to-end delay

AppApp

GetElapsedTime(); PredictDownstreamTime(responseSize);

Adapt Response

Page 35: End-to-End Performance Analytics For Mobile Apps

35

Timecard

App

Server

Desired end-to-end delay

App

GetElapsedTime(); PredictDownstreamTime(responseSize);

Page 36: End-to-End Performance Analytics For Mobile Apps

36

• Online Transaction Tracking• Time Synchronization• Downstream Delay Predictor– Downlink delay– App processing delay

Timecard

Page 37: End-to-End Performance Analytics For Mobile Apps

37

Timecard Implementation

App App

Server

Transaction Tracking

Transaction Tracking

Logging

Predictor

Time Sync

Data Collection

Automatic Instrumentation• WP Apps• ASP .NET services APIs