performance monitoring for the new front end

100
Performance Monitoring for the New Front End By Emily Nakashima, @eanakashima & Rachel Myers, @rachelmyers bit.ly/ostrichandyak

Upload: eanakashima

Post on 27-Jan-2015

115 views

Category:

Documents


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Performance Monitoring for the New Front End

Performance Monitoring for the

New Front End

By Emily Nakashima, @eanakashima& Rachel Myers, @rachelmyers

bit.ly/ostrichandyak

Page 2: Performance Monitoring for the New Front End

Aka: Monitoring Single-Page App

Performance

Page 3: Performance Monitoring for the New Front End

Aka: SayGoodbye tothe Ostrich.

Page 4: Performance Monitoring for the New Front End

Aka: SayGoodbye tothe Ostrich.

Page 5: Performance Monitoring for the New Front End

The Agenda

I. Why Performance?

II. Burying our Head in the Sand

III.Epic Performance Monitoring Yak Shave

IV.The Future

Page 6: Performance Monitoring for the New Front End
Page 7: Performance Monitoring for the New Front End
Page 8: Performance Monitoring for the New Front End
Page 9: Performance Monitoring for the New Front End
Page 10: Performance Monitoring for the New Front End

I. Why Performance?

bit.ly/ostrichandyak

Page 11: Performance Monitoring for the New Front End

Most Performance is in the Front End

Back end Front end

Page 12: Performance Monitoring for the New Front End

Slow Pages Hurt

Page 13: Performance Monitoring for the New Front End

Slow Pages Hurt

• Bing: ⬆2s = ⬇4.3% revenue/user

Page 14: Performance Monitoring for the New Front End

Slow Pages Hurt

• Bing: ⬆2s = ⬇4.3% revenue/user

• Google: ⬆400ms = ⬇.59% searches/user

Page 15: Performance Monitoring for the New Front End

Slow Pages Hurt

• Bing: ⬆2s = ⬇4.3% revenue/user

• Google: ⬆400ms = ⬇.59% searches/user

• Yahoo: ⬆400ms = ⬇5-9% traffic

Page 16: Performance Monitoring for the New Front End

Fast Pages Help

Page 17: Performance Monitoring for the New Front End

Fast Pages Help

• Mozilla:

Page 18: Performance Monitoring for the New Front End

Fast Pages Help

• Mozilla:

• ⬇2.2s = ⬆15.4% Firefox downloads (+60M)

Page 19: Performance Monitoring for the New Front End

Fast Pages Help

• Mozilla:

• ⬇2.2s = ⬆15.4% Firefox downloads (+60M)

• Shopzilla:

Page 20: Performance Monitoring for the New Front End

Fast Pages Help

• Mozilla:

• ⬇2.2s = ⬆15.4% Firefox downloads (+60M)

• Shopzilla:

• conversion ⬆ 7 - 12%

Page 21: Performance Monitoring for the New Front End

Fast Pages Help

• Mozilla:

• ⬇2.2s = ⬆15.4% Firefox downloads (+60M)

• Shopzilla:

• conversion ⬆ 7 - 12%

• 2x sessions from Search Engine Marketing

Page 22: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

Page 23: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

• eBay:

Page 24: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

• eBay:

• Beginning of experiment: ⬇.44% searches

Page 25: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

• eBay:

• Beginning of experiment: ⬇.44% searches

• End of experiment:⬇.76% searches

Page 26: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

• eBay:

• Beginning of experiment: ⬇.44% searches

• End of experiment:⬇.76% searches

• After correction: ⬇.21% searches

Page 27: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

• eBay:

• Beginning of experiment: ⬇.44% searches

• End of experiment:⬇.76% searches

• After correction: ⬇.21% searches

• Strangeloop:

Page 28: Performance Monitoring for the New Front End

Cumulative and Lasting Effects

• eBay:

• Beginning of experiment: ⬇.44% searches

• End of experiment:⬇.76% searches

• After correction: ⬇.21% searches

• Strangeloop:

• Took 6 weeks for experiment group visits to recover

Page 29: Performance Monitoring for the New Front End

Why Performance: The bottom line.

Page 30: Performance Monitoring for the New Front End

II. Burying our Head in the Sand.

Page 31: Performance Monitoring for the New Front End
Page 32: Performance Monitoring for the New Front End

dinosaurs partying with cake and a new relic dashboard!

Page 33: Performance Monitoring for the New Front End

dinosaurs partying with cake and a new relic dashboard!

Page 34: Performance Monitoring for the New Front End
Page 35: Performance Monitoring for the New Front End
Page 36: Performance Monitoring for the New Front End
Page 37: Performance Monitoring for the New Front End
Page 38: Performance Monitoring for the New Front End
Page 39: Performance Monitoring for the New Front End
Page 40: Performance Monitoring for the New Front End
Page 41: Performance Monitoring for the New Front End

12 bijillion

Page 42: Performance Monitoring for the New Front End
Page 43: Performance Monitoring for the New Front End
Page 44: Performance Monitoring for the New Front End

Backbone: the Ostrich Killer

Screenshot of tablet site

Page 45: Performance Monitoring for the New Front End

Backbone: the Ostrich Killer

Screenshot of tablet site

Page 46: Performance Monitoring for the New Front End
Page 47: Performance Monitoring for the New Front End
Page 48: Performance Monitoring for the New Front End
Page 49: Performance Monitoring for the New Front End
Page 50: Performance Monitoring for the New Front End
Page 51: Performance Monitoring for the New Front End
Page 52: Performance Monitoring for the New Front End
Page 53: Performance Monitoring for the New Front End

dinosaurs partying with cake and a new relic dashboard!

Page 54: Performance Monitoring for the New Front End

dinosaurs partying with cake and a new relic dashboard!

Page 55: Performance Monitoring for the New Front End
Page 56: Performance Monitoring for the New Front End
Page 57: Performance Monitoring for the New Front End

A Diagnostic Slide

• Do you load content with ajax?

• Do you <3 any of these buzzwords?

Ember / Backbone / Angular / whatever-mvc

Turbolinks in Rails4

pjax/hijax

pushState

Page 58: Performance Monitoring for the New Front End

III. Epic Performance MonitoringYak Shave

Page 59: Performance Monitoring for the New Front End

Our old tools

• YSlow / PageSpeed Insights

• New Relic

• LogNormal

• WebPageTest

Page 60: Performance Monitoring for the New Front End

YSlow / PageSpeed

Page 61: Performance Monitoring for the New Front End

New Relic

Page 62: Performance Monitoring for the New Front End

New Relic

Page 63: Performance Monitoring for the New Front End

LogNormal

Page 64: Performance Monitoring for the New Front End

LogNormal

Page 65: Performance Monitoring for the New Front End

LogNormal

Page 66: Performance Monitoring for the New Front End

WebPageTest

Page 67: Performance Monitoring for the New Front End

WebPageTest

Page 68: Performance Monitoring for the New Front End

WebPageTest

Page 69: Performance Monitoring for the New Front End

Nope.

Page 70: Performance Monitoring for the New Front End

New things to track

• Feature load

• “Page” load

• Unresponsiveness (jank)

Page 71: Performance Monitoring for the New Front End

New things to track

• { featureName: loadTime }

• { pageName: loadTime }

• [ timestamp, timestamp, timestamp... ]

Page 72: Performance Monitoring for the New Front End

Surprise tools to the rescue.

• Google Analytics

• Circonus

Page 73: Performance Monitoring for the New Front End

Google Analytics

Page 74: Performance Monitoring for the New Front End

Google Analytics

Page 75: Performance Monitoring for the New Front End

Google Analytics

Page 76: Performance Monitoring for the New Front End

Google Analytics

The code to add tracking can be fairly straightforward:

_gaq.push([‘_trackTiming’, category, variable, time, opt_label, opt_sample]);

Page 77: Performance Monitoring for the New Front End

Circonus

Page 78: Performance Monitoring for the New Front End

Circonus

Page 79: Performance Monitoring for the New Front End

All together

Page 80: Performance Monitoring for the New Front End

Feature load

Page 81: Performance Monitoring for the New Front End

Feature loadTrackTiming = function(category, feature) {  this.category = category;  this.feature = feature;  this.startTime = new Date().getTime();  this.endTime = null;  return this;};

TrackTiming.prototype.startTime = new Date().getTime(); // shared startTime

TrackTiming.prototype.setEnd = function() {  this.endTime = new Date().getTime();  return this;};

Page 82: Performance Monitoring for the New Front End

Feature loadTrackTiming.prototype.sendFeatureTiming = function() { var time = this.endTime - this.startTime; var twoMinutes = 1000 * 60 * 2; if (time < twoMinutes && time > 0) { window._gaq.push(['_trackTiming', this.category, this.feature, time]); } return this;};

var tt = new TrackTiming(); // init$(‘#myImg’).on('load', function() { tt.setEndTime().sendFeatureTiming();});

Page 83: Performance Monitoring for the New Front End

“Page” load

Page 84: Performance Monitoring for the New Front End

“Page” load

• Composed of many features.

• “Page” is loaded is called when sendFeatureTiming has been called for each feature.

Page 85: Performance Monitoring for the New Front End

“Page” loadTrackTiming.prototype.sendPageTiming = function(pageName) { var time = this.endTime - this.startTime;

window._gaq.push(['_trackTiming', 'custom_timings', pageName, time]);};

// ... set up feature tracking here ...

$.when(trackTiming1, trackTiming2).done( function() { tt.sendPageTiming(); }); // resolves when both timings are done

Page 86: Performance Monitoring for the New Front End

Unresponsiveness

Page 87: Performance Monitoring for the New Front End

Unresponsiveness

Page 88: Performance Monitoring for the New Front End

Unresponsiveness

• Hardest to manage observer effects.

• Strategy: look for moments when the browser isn’t free to take orders.

• Use setTimeout to set timestamps, and see how far apart they fall.

Page 89: Performance Monitoring for the New Front End

Unresponsivenessvar measurements = [];var now = new Date();

var checkTime = function(measurements) { var newNow = new Date(); measurements.push(newNow - now); now = newNow; setTimeout(checkTime,300);};

// collects an array of times:// measurements = [357,300,300,424,404,300]

Page 90: Performance Monitoring for the New Front End
Page 91: Performance Monitoring for the New Front End
Page 92: Performance Monitoring for the New Front End

IV. The Future

Page 93: Performance Monitoring for the New Front End
Page 94: Performance Monitoring for the New Front End

Recap: newthings to track

• Feature load

• “Page” load

• Unresponsiveness (jank)

Page 95: Performance Monitoring for the New Front End

Feature load

Page 96: Performance Monitoring for the New Front End

“Page” load// We modified our backbone app to always// call beforeRoute & afterRoute callbacks,// a low-config way to tracking loading.

var beforeRoute = function() { tt.resetPageTiming();};

var afterRoute = function() {var currentPage = window.location;tt.sendPageTiming(currentPage);

};

Page 97: Performance Monitoring for the New Front End

Unresponsiveness

Page 98: Performance Monitoring for the New Front End
Page 99: Performance Monitoring for the New Front End
Page 100: Performance Monitoring for the New Front End

Thanks!

@eanakashima & @rachelmyersbit.ly/ostrichandyak