Slide 1

Slide 1 text

The Truth About Your
 Web App’s Performance John Riviello - @JohnRiv JSConf - May 28, 2014

Slide 2

Slide 2 text

John Riviello – The Truth Behind Your Web App’s Performance 2

Slide 3

Slide 3 text

Frontend Performance Data 1.  What do existing tools provide? 2.  What data do you care about? 3.  How do you gather that data? 4.  What do you do with the data? John Riviello – The Truth Behind Your Web App’s Performance 3

Slide 4

Slide 4 text

1. Existing Tools 2. The Data You Care About 3. Gathering the Data 4. Analyzing the Data

Slide 5

Slide 5 text

Frontend Performance Data – Existing Tools WebPagetest.org John Riviello – The Truth Behind Your Web App’s Performance 5

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Frontend Performance Data – Existing Tools http://macbre.github.io/phantomas/ https://github.com/gmetais/grunt-devperf John Riviello – The Truth Behind Your Web App’s Performance 11

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

"RUM" (https://www.flickr.com/photos/tom-b/1330310701/) by Tom B (https://www.flickr.com/photos/tom-b/) is licensed under CC BY-NC-SA 2.0 (https://creativecommons.org/licenses/by-nc-sa/2.0/)

Slide 14

Slide 14 text

Real User Monitoring "yes, that's a rum filled coconut." (https://www.flickr.com/photos/bking/346334125) by Brandon King (https://www.flickr.com/photos/bking/) is licensed under CC BY-NC 2.0 (https://creativecommons.org/licenses/by-nc/2.0/) / Color adjusted from original

Slide 15

Slide 15 text

Frontend Performance Data – Existing Tools http://newrelic.com/ John Riviello – The Truth Behind Your Web App’s Performance 15

Slide 16

Slide 16 text

http://docs.newrelic.com/docs/new-relic-browser/page-load-timing-process

Slide 17

Slide 17 text

http://blog.newrelic.com/2014/03/13/javascript-error-reporting-ajax-timing-new-relic/

Slide 18

Slide 18 text

http://docs.newrelic.com/docs/new-relic-browser/ajax-dashboard

Slide 19

Slide 19 text

http://docs.newrelic.com/docs/new-relic-browser/manually-reporting-page-load-timing-data

Slide 20

Slide 20 text

1. Existing Tools 2. The Data You Care About 3. Gathering the Data 4. Analyzing the Data

Slide 21

Slide 21 text

Real User Monitoring "yes, that's a rum filled coconut." (https://www.flickr.com/photos/bking/346334125) by Brandon King (https://www.flickr.com/photos/bking/) is licensed under CC BY-NC 2.0 (https://creativecommons.org/licenses/by-nc/2.0/) / Color adjusted from original

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Illustration from http://www.w3.org/TR/navigation-timing/#processing-model John Riviello – The Truth Behind Your Web App’s Performance 24

Slide 25

Slide 25 text

Illustration from http://www.w3.org/TR/navigation-timing/#processing-model John Riviello – The Truth Behind Your Web App’s Performance 25

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

John Riviello – The Truth Behind Your Web App’s Performance 27

Slide 28

Slide 28 text

John Riviello – The Truth Behind Your Web App’s Performance 28

Slide 29

Slide 29 text

Frontend Performance Data – The Data You Care About John Riviello – The Truth Behind Your Web App’s Performance 29

Slide 30

Slide 30 text

Frontend Performance Data – The Data You Care About Example Factors That Impact Performance: John Riviello – The Truth Behind Your Web App’s Performance 30 •  User authentication state • “Type” of user •  Number of “items” returned •  SWF dependency

Slide 31

Slide 31 text

John Riviello – The Truth Behind Your Web App’s Performance 31

Slide 32

Slide 32 text

http://mashable.com/2014/01/31/gmail-slow/ John Riviello – The Truth Behind Your Web App’s Performance 32 “Gmail’s People Widget appears to be the cause of the sluggishness, which is, only affecting Gmail on the web Google says… This is noticeable when users open an email conversation with a large number of participants…”

Slide 33

Slide 33 text

Consider what other unique factors in your app may impact performance

Slide 34

Slide 34 text

1. Existing Tools 2. The Data You Care About 3. Gathering the Data 4. Analyzing the Data

Slide 35

Slide 35 text

John Riviello – The Truth Behind Your Web App’s Performance 35

Slide 36

Slide 36 text

Frontend Performance Data – Gathering the Data Marking Timestamps John Riviello – The Truth Behind Your Web App’s Performance 36 Back in the day: >  new  Date().getTime();        1399754123456   ECMAScript 5.1: >  Date.now();        1399754123456   Most modern browsers have a better option…      

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Frontend Performance Data – Gathering the Data W3C High Resolution Time John Riviello – The Truth Behind Your Web App’s Performance 38 • DOMHighResTimeStamp is available via window.performance.now() • Provides the time with sub-millisecond accuracy • Measured relative to the navigationStart attribute of the PerformanceTiming interface • Not subject to system clock skew or adjustments (uses a monotonically increasing clock)

Slide 39

Slide 39 text

Frontend Performance Data – Gathering the Data W3C High Resolution Time – Sub-ms Example John Riviello – The Truth Behind Your Web App’s Performance 39 >  var  dateTest  =  function()  {              var  start  =  Date.now(),                      area  =  window.innerWidth*window.innerHeight;              return  Date.now()  -­‐  start;      };      dateTest();      0     >  var  highResTest  =  function()  {              var  start  =  window.performance.now(),                      area  =  window.innerWidth*window.innerHeight;              return  window.performance.now()  -­‐  start;      };      highResTest();      0.01200000406242907  

Slide 40

Slide 40 text

Frontend Performance Data – Gathering the Data W3C High Resolution Time – Monotonic Clock John Riviello – The Truth Behind Your Web App’s Performance 40 Why do we care? “Most systems run a daemon which regularly synchronizes the time. It is common for the clock to be tweaked a few milliseconds every 15-20 minutes. At that rate about 1% of 10 second intervals measured would be inaccurate.” Source: Tony Gentilcore http://gent.ilcore.com/2012/06/better-timer-for-javascript.html

Slide 41

Slide 41 text

John Riviello – The Truth Behind Your Web App’s Performance 41

Slide 42

Slide 42 text

John Riviello – The Truth Behind Your Web App’s Performance 42

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

Browser Support

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

John Riviello – The Truth Behind Your Web App’s Performance 49

Slide 50

Slide 50 text

John Riviello – The Truth Behind Your Web App’s Performance 50

Slide 51

Slide 51 text

https://github.com/Comcast/Surf-N-Perf

Slide 52

Slide 52 text

1. Existing Tools 2. The Data You Care About 3. Gathering the Data 4. Analyzing the Data

Slide 53

Slide 53 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 53

Slide 54

Slide 54 text

Average Response Times are for Average Products

Slide 55

Slide 55 text

99th PERCENTILE (at a minimum)

Slide 56

Slide 56 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 56

Slide 57

Slide 57 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 57

Slide 58

Slide 58 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 58

Slide 59

Slide 59 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 59

Slide 60

Slide 60 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 60

Slide 61

Slide 61 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 61

Slide 62

Slide 62 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 62

Slide 63

Slide 63 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 63

Slide 64

Slide 64 text

Frontend Performance Data – Analyzing The Data John Riviello – The Truth Behind Your Web App’s Performance 64

Slide 65

Slide 65 text

Recap

Slide 66

Slide 66 text

Frontend Performance Data – Recap John Riviello – The Truth Behind Your Web App’s Performance 66 • Measure first—at the 99th percentile • Log Network Latency, Processing Time, and Full Webpage Request • Log major app-specific events with details • Leverage W3C Performance APIs For Further Info: Twitter: @JohnRiv GitHub: https://github.com/Comcast/Surf-N-Perf