diy synthetic: private webpagetest magic

111
DIY Synthetic: Private WebPagetest Magic Velocity NY 2013 Jonathan Klein @jonathanklein Wednesday, October 16, 13

Upload: jonathan-klein

Post on 09-May-2015

1.613 views

Category:

Technology


0 download

DESCRIPTION

I gave this talk at Velocity NY 2013, and it covers the installation and use of a private WebPagetest instance, as well as the open source tool wpt-script which Etsy built.

TRANSCRIPT

Page 1: DIY Synthetic: Private WebPagetest Magic

DIY Synthetic: Private WebPagetest MagicVelocity NY 2013Jonathan Klein@jonathanklein

Wednesday, October 16, 13

Page 2: DIY Synthetic: Private WebPagetest Magic

Slides, Linksjkle.in/wpt

Wednesday, October 16, 13

Page 3: DIY Synthetic: Private WebPagetest Magic

About Me

Wednesday, October 16, 13

Page 4: DIY Synthetic: Private WebPagetest Magic

About Me•Performance Engineer At Etsy

Wednesday, October 16, 13

Page 5: DIY Synthetic: Private WebPagetest Magic

About Me•Performance Engineer At Etsy• I write the Etsy Site Performance Reports

Wednesday, October 16, 13

Page 6: DIY Synthetic: Private WebPagetest Magic

About Me•Performance Engineer At Etsy• I write the Etsy Site Performance Reports•Organize Boston Web Perf Meetup Group

Wednesday, October 16, 13

Page 7: DIY Synthetic: Private WebPagetest Magic

Etsy Stats

Wednesday, October 16, 13

Page 8: DIY Synthetic: Private WebPagetest Magic

Etsy Stats•World’s largest handmade marketplace

Wednesday, October 16, 13

Page 9: DIY Synthetic: Private WebPagetest Magic

Etsy Stats•World’s largest handmade marketplace• 1.5 billion page views/month

Wednesday, October 16, 13

Page 10: DIY Synthetic: Private WebPagetest Magic

Etsy Stats•World’s largest handmade marketplace• 1.5 billion page views/month•Almost $1B in sales last year

Wednesday, October 16, 13

Page 11: DIY Synthetic: Private WebPagetest Magic

+160k to a page = +12% bounce rate

on mobile

Wednesday, October 16, 13

Page 12: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring

Wednesday, October 16, 13

Page 13: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 14: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring Real User Monitoring

Browser Instrumentation Navigation Timing API

Consistent trending over time

Highly variable

Largely in your control Last mile difficulties

Great for identifying regressions

Great for comparing across geographies/browsers

Not super realistic “Real User Monitoring”

Wednesday, October 16, 13

Page 15: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring Real User Monitoring

Browser Instrumentation Navigation Timing API

Consistent trending over time

Highly variable

Largely in your control Last mile difficulties

Great for identifying regressions

Great for comparing across geographies/browsers

Not super realistic “Real User Monitoring”

Wednesday, October 16, 13

Page 16: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring Real User Monitoring

Browser Instrumentation Navigation Timing API

Consistent trending over time

Highly variable

Largely in your control Last mile difficulties

Great for identifying regressions

Great for comparing across geographies/browsers

Not super realistic “Real User Monitoring”

Wednesday, October 16, 13

Page 17: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring Real User Monitoring

Browser Instrumentation Navigation Timing API

Consistent trending over time

Highly variable

Largely in your control Last mile difficulties

Great for identifying regressions

Great for comparing across geographies/browsers

Not super realistic “Real User Monitoring”

Wednesday, October 16, 13

Page 18: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring Real User Monitoring

Browser Instrumentation Navigation Timing API

Consistent trending over time

Highly variable

Largely in your control Last mile difficulties

Great for identifying regressions

Great for comparing across geographies/browsers

Not super realistic “Real User Monitoring”

Wednesday, October 16, 13

Page 19: DIY Synthetic: Private WebPagetest Magic

Synthetic Monitoring Real User Monitoring

Browser Instrumentation Navigation Timing API

Consistent trending over time

Highly variable

Largely in your control Last mile difficulties

Great for identifying regressions

Great for comparing across geographies/browsers

Not super realistic “Real User Monitoring”

Wednesday, October 16, 13

Page 20: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 21: DIY Synthetic: Private WebPagetest Magic

$$$$

Wednesday, October 16, 13

Page 22: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 23: DIY Synthetic: Private WebPagetest Magic

Background

Wednesday, October 16, 13

Page 24: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 25: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 26: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 27: DIY Synthetic: Private WebPagetest Magic

EC2 Test Agents

Wednesday, October 16, 13

Page 28: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 29: DIY Synthetic: Private WebPagetest Magic

No Built-in Automation

Wednesday, October 16, 13

Page 30: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 31: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 32: DIY Synthetic: Private WebPagetest Magic

wpt-script

Wednesday, October 16, 13

Page 33: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 34: DIY Synthetic: Private WebPagetest Magic

Motivation

Wednesday, October 16, 13

Page 35: DIY Synthetic: Private WebPagetest Magic

Why We Use It

Wednesday, October 16, 13

Page 36: DIY Synthetic: Private WebPagetest Magic

Why We Use It•Wanted long term synthetic trending

Wednesday, October 16, 13

Page 37: DIY Synthetic: Private WebPagetest Magic

Why We Use It•Wanted long term synthetic trending• Automated tests

Wednesday, October 16, 13

Page 38: DIY Synthetic: Private WebPagetest Magic

Why We Use It•Wanted long term synthetic trending• Automated tests•More control

Wednesday, October 16, 13

Page 39: DIY Synthetic: Private WebPagetest Magic

Why We Use It•Wanted long term synthetic trending• Automated tests•More control• Low cost

Wednesday, October 16, 13

Page 40: DIY Synthetic: Private WebPagetest Magic

Easy Configuration

Wednesday, October 16, 13

Page 41: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://www.yourwptinstall.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.anotherexample.com"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log"}

Wednesday, October 16, 13

Page 42: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://www.yourwptinstall.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.anotherexample.com"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log"}

Wednesday, October 16, 13

Page 43: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://www.yourwptinstall.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.anotherexample.com"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log"}

Wednesday, October 16, 13

Page 44: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://www.yourwptinstall.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.anotherexample.com"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log"}

Wednesday, October 16, 13

Page 45: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://www.yourwptinstall.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.anotherexample.com"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log"}

Wednesday, October 16, 13

Page 46: DIY Synthetic: Private WebPagetest Magic

# Run Test*/25 * * * * php run.php

Wednesday, October 16, 13

Page 47: DIY Synthetic: Private WebPagetest Magic

# Run Test*/25 * * * * php run.php -c foo.conf

Wednesday, October 16, 13

Page 48: DIY Synthetic: Private WebPagetest Magic

# Run Test*/25 * * * * php run.php -c foo.conf

# Get Results* * * * * php get_results.php

Wednesday, October 16, 13

Page 49: DIY Synthetic: Private WebPagetest Magic

Advanced Features

Wednesday, October 16, 13

Page 50: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://example.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.webpagetest.org"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log",    "prepend": "Login",    "username": "someuser",    "password": "somepassword",    "run_options": {        "video": 0    }}

Wednesday, October 16, 13

Page 51: DIY Synthetic: Private WebPagetest Magic

{    "server": "http://example.com",    "pending_dir": "private",    "locations": ["US_East_wptdriver:Firefox", "US_East_wptdriver:Chrome"],    "urls": {        "label": "http://www.example.com",        "other_label": "http://www.webpagetest.org"    },    "graphite": "graphite.example.com",    "logging_ns": "webpagetest.private",    "splunkLog": "/var/log/webpagetest/results.log", "prepend": ["BlockThirdParty", "bypass_cdn.txt"],    "run_options": {        "video": 0    }}

Wednesday, October 16, 13

Page 52: DIY Synthetic: Private WebPagetest Magic

foreach ($prepends as $prepend) { if (file_exists($scripts_dir . $prepend)) { $script .= file_get_contents($scripts_dir . $prepend); } elseif (method_exists($this, $prepend)) { $script .= $this->$prepend(); }}

Wednesday, October 16, 13

Page 53: DIY Synthetic: Private WebPagetest Magic

setDns site.etsystatic.com 38.106.64.123setDns img0.etsystatic.com 38.106.64.125setDns img1.etsystatic.com 38.106.64.125setDns img2.etsystatic.com 38.106.64.125setDns img3.etsystatic.com 38.106.64.125setDns ny-image0.etsy.com 38.106.64.125setDns ny-image1.etsy.com 38.106.64.125setDns ny-image2.etsy.com 38.106.64.125setDns ny-image3.etsy.com 38.106.64.125

bypass_cdn.txt

Wednesday, October 16, 13

Page 54: DIY Synthetic: Private WebPagetest Magic

Gathering Results

Wednesday, October 16, 13

Page 55: DIY Synthetic: Private WebPagetest Magic

<?php

// Splunk$splunkLogger = new SplunkLogger($config['splunkLog'], $logging_ns);foreach ($results as $result) { $splunkLogger->log($result);}

// Graphite$grapher = new Grapher($config['graphite'], $logging_ns);$grapher->graphResults($results);

Wednesday, October 16, 13

Page 56: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 57: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 58: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 59: DIY Synthetic: Private WebPagetest Magic

https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/metricsWednesday, October 16, 13

Page 60: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 61: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 62: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 63: DIY Synthetic: Private WebPagetest Magic

Disadvantages vs. Paid Tools

Wednesday, October 16, 13

Page 64: DIY Synthetic: Private WebPagetest Magic

Disadvantages vs. Paid Tools•Harder to set up/maintain

Wednesday, October 16, 13

Page 65: DIY Synthetic: Private WebPagetest Magic

Disadvantages vs. Paid Tools•Harder to set up/maintain• Functionality

Wednesday, October 16, 13

Page 66: DIY Synthetic: Private WebPagetest Magic

Disadvantages vs. Paid Tools•Harder to set up/maintain• Functionality•Regions

Wednesday, October 16, 13

Page 67: DIY Synthetic: Private WebPagetest Magic

Disadvantages vs. Paid Tools•Harder to set up/maintain• Functionality•Regions• Full page oriented

Wednesday, October 16, 13

Page 68: DIY Synthetic: Private WebPagetest Magic

Disadvantages vs. Paid Tools•Harder to set up/maintain• Functionality•Regions• Full page oriented• Less consistent

Wednesday, October 16, 13

Page 69: DIY Synthetic: Private WebPagetest Magic

Advantages vs. Paid Tools

Wednesday, October 16, 13

Page 70: DIY Synthetic: Private WebPagetest Magic

Advantages vs. Paid Tools•Cost

Wednesday, October 16, 13

Page 71: DIY Synthetic: Private WebPagetest Magic

Advantages vs. Paid Tools•Cost• Flexibility

Wednesday, October 16, 13

Page 72: DIY Synthetic: Private WebPagetest Magic

Advantages vs. Paid Tools•Cost• Flexibility•People know the tool

Wednesday, October 16, 13

Page 73: DIY Synthetic: Private WebPagetest Magic

Advantages vs. Paid Tools•Cost• Flexibility•People know the tool•Multi-page flows

Wednesday, October 16, 13

Page 74: DIY Synthetic: Private WebPagetest Magic

Advantages vs. Paid Tools•Cost• Flexibility•People know the tool•Multi-page flows• Scripting

Wednesday, October 16, 13

Page 75: DIY Synthetic: Private WebPagetest Magic

Our Use Cases

Wednesday, October 16, 13

Page 76: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint

Wednesday, October 16, 13

Page 77: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows

Wednesday, October 16, 13

Page 78: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests

Wednesday, October 16, 13

Page 79: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing

Wednesday, October 16, 13

Page 80: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing• Ad-hoc tests

Wednesday, October 16, 13

Page 81: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing• Ad-hoc tests

• DNS

Wednesday, October 16, 13

Page 82: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing• Ad-hoc tests

• DNS• API

Wednesday, October 16, 13

Page 83: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing• Ad-hoc tests

• DNS• API• Single Object Tests

Wednesday, October 16, 13

Page 84: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing• Ad-hoc tests

• DNS• API• Single Object Tests•Multiple locations

Wednesday, October 16, 13

Page 85: DIY Synthetic: Private WebPagetest Magic

WebPagetest Catchpoint•Multi-page flows• Scripted tests• High volume testing• Ad-hoc tests

• DNS• API• Single Object Tests•Multiple locations• Comparisons

Wednesday, October 16, 13

Page 86: DIY Synthetic: Private WebPagetest Magic

Future Work

Wednesday, October 16, 13

Page 87: DIY Synthetic: Private WebPagetest Magic

Improving the Process

Wednesday, October 16, 13

Page 88: DIY Synthetic: Private WebPagetest Magic

Improving the Process•Manage disk space

Wednesday, October 16, 13

Page 89: DIY Synthetic: Private WebPagetest Magic

Improving the Process•Manage disk space•Multiple regions

Wednesday, October 16, 13

Page 90: DIY Synthetic: Private WebPagetest Magic

Improving the Process•Manage disk space•Multiple regions•More canned scripts

Wednesday, October 16, 13

Page 91: DIY Synthetic: Private WebPagetest Magic

Improving the Process•Manage disk space•Multiple regions•More canned scripts•Automate upgrades

Wednesday, October 16, 13

Page 92: DIY Synthetic: Private WebPagetest Magic

Leveraging WebPagetest

Wednesday, October 16, 13

Page 93: DIY Synthetic: Private WebPagetest Magic

Leveraging WebPagetest• Front-end SPOF

Wednesday, October 16, 13

Page 94: DIY Synthetic: Private WebPagetest Magic

Leveraging WebPagetest• Front-end SPOF•User Timings (AFT)

Wednesday, October 16, 13

Page 95: DIY Synthetic: Private WebPagetest Magic

Leveraging WebPagetest• Front-end SPOF•User Timings (AFT)• Speed Index

Wednesday, October 16, 13

Page 96: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 97: DIY Synthetic: Private WebPagetest Magic

Improving WebPagetest

Wednesday, October 16, 13

Page 98: DIY Synthetic: Private WebPagetest Magic

WebPagetest + Vagrant

Wednesday, October 16, 13

Page 99: DIY Synthetic: Private WebPagetest Magic

WebPagetest + Vagrant• Install VirtualBox

Wednesday, October 16, 13

Page 100: DIY Synthetic: Private WebPagetest Magic

WebPagetest + Vagrant• Install VirtualBox• Install Vagrant

Wednesday, October 16, 13

Page 101: DIY Synthetic: Private WebPagetest Magic

WebPagetest + Vagrant• Install VirtualBox• Install Vagrant• https://gist.github.com/jklein/6992296

Wednesday, October 16, 13

Page 102: DIY Synthetic: Private WebPagetest Magic

WebPagetest + Vagrant• Install VirtualBox• Install Vagrant• https://gist.github.com/jklein/6992296•vagrant up

Wednesday, October 16, 13

Page 103: DIY Synthetic: Private WebPagetest Magic

WebPagetest + Vagrant• Install VirtualBox• Install Vagrant• https://gist.github.com/jklein/6992296•vagrant up

• http://localhost:8080

Wednesday, October 16, 13

Page 104: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 105: DIY Synthetic: Private WebPagetest Magic

800MB

Wednesday, October 16, 13

Page 106: DIY Synthetic: Private WebPagetest Magic

webpagetest-api

Wednesday, October 16, 13

Page 107: DIY Synthetic: Private WebPagetest Magic

Wednesday, October 16, 13

Page 108: DIY Synthetic: Private WebPagetest Magic

Both Are Good Options

Wednesday, October 16, 13

Page 109: DIY Synthetic: Private WebPagetest Magic

Results > Tools

Wednesday, October 16, 13

Page 110: DIY Synthetic: Private WebPagetest Magic

Thanks!

Wednesday, October 16, 13

Page 111: DIY Synthetic: Private WebPagetest Magic

@jonathanklein

[email protected]

www.etsy.com/careers

Get in Touch

Wednesday, October 16, 13