SlideShare a Scribd company logo
DIY Synthetic:
Private WebPagetest Magic
Velocity NY 2013
Jonathan Klein
@jonathanklein
Wednesday, October 16, 13
Slides, Links
jkle.in/wpt

Wednesday, October 16, 13
About Me

Wednesday, October 16, 13
About Me
• Performance Engineer At Etsy

Wednesday, October 16, 13
About Me
• Performance Engineer At Etsy
• I write the Etsy Site Performance Reports

Wednesday, October 16, 13
About Me
• Performance Engineer At Etsy
• I write the Etsy Site Performance Reports
• Organize Boston Web Perf Meetup Group

Wednesday, October 16, 13
Etsy Stats

Wednesday, October 16, 13
Etsy Stats
• World’s largest handmade marketplace

Wednesday, October 16, 13
Etsy Stats
• World’s largest handmade marketplace
• 1.5 billion page views/month

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

Wednesday, October 16, 13
+160k to a page =
+12% bounce rate
on mobile
Wednesday, October 16, 13
Synthetic Monitoring

Wednesday, October 16, 13
Wednesday, October 16, 13
Synthetic 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

Wednesday, October 16, 13

Real User Monitoring

“Real User Monitoring”
Synthetic 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

Wednesday, October 16, 13

Real User Monitoring

“Real User Monitoring”
Synthetic 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

Wednesday, October 16, 13

Real User Monitoring

“Real User Monitoring”
Synthetic 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

Wednesday, October 16, 13

Real User Monitoring

“Real User Monitoring”
Synthetic 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

Wednesday, October 16, 13

Real User Monitoring

“Real User Monitoring”
Synthetic 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

Wednesday, October 16, 13

Real User Monitoring

“Real User Monitoring”
Wednesday, October 16, 13
$$$$

Wednesday, October 16, 13
Wednesday, October 16, 13
Background

Wednesday, October 16, 13
Wednesday, October 16, 13
Wednesday, October 16, 13
Wednesday, October 16, 13
EC2 Test Agents

Wednesday, October 16, 13
Wednesday, October 16, 13
No Built-in Automation

Wednesday, October 16, 13
Wednesday, October 16, 13
Wednesday, October 16, 13
wpt-script

Wednesday, October 16, 13
Wednesday, October 16, 13
Motivation

Wednesday, October 16, 13
Why We Use It

Wednesday, October 16, 13
Why We Use It
• Wanted long term synthetic trending

Wednesday, October 16, 13
Why We Use It
• Wanted long term synthetic trending
• Automated tests

Wednesday, October 16, 13
Why We Use It
• Wanted long term synthetic trending
• Automated tests
• More control

Wednesday, October 16, 13
Why We Use It
• Wanted long term synthetic trending
• Automated tests
• More control
• Low cost

Wednesday, October 16, 13
Easy Configuration

Wednesday, October 16, 13
{
    "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
{
    "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
{
    "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
{
    "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
{
    "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
# Run Test
*/25 * * * * php run.php

Wednesday, October 16, 13
# Run Test
*/25 * * * * php run.php -c foo.conf

Wednesday, October 16, 13
# Run Test
*/25 * * * * php run.php -c foo.conf
# Get Results
* * * * * php get_results.php

Wednesday, October 16, 13
Advanced Features

Wednesday, October 16, 13
{
    "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
{
    "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
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
bypass_cdn.txt
setDns
setDns
setDns
setDns
setDns
setDns
setDns
setDns
setDns

Wednesday, October 16, 13

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

Wednesday, October 16, 13
<?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
Wednesday, October 16, 13
Wednesday, October 16, 13
Wednesday, October 16, 13
https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/metrics
Wednesday, October 16, 13
Wednesday, October 16, 13
Wednesday, October 16, 13
Wednesday, October 16, 13
Disadvantages vs. Paid Tools

Wednesday, October 16, 13
Disadvantages vs. Paid Tools
• Harder to set up/maintain

Wednesday, October 16, 13
Disadvantages vs. Paid Tools
• Harder to set up/maintain
• Functionality

Wednesday, October 16, 13
Disadvantages vs. Paid Tools
• Harder to set up/maintain
• Functionality
• Regions

Wednesday, October 16, 13
Disadvantages vs. Paid Tools
• Harder to set up/maintain
• Functionality
• Regions
• Full page oriented

Wednesday, October 16, 13
Disadvantages vs. Paid Tools
• Harder to set up/maintain
• Functionality
• Regions
• Full page oriented
• Less consistent

Wednesday, October 16, 13
Advantages vs. Paid Tools

Wednesday, October 16, 13
Advantages vs. Paid Tools
• Cost

Wednesday, October 16, 13
Advantages vs. Paid Tools
• Cost
• Flexibility

Wednesday, October 16, 13
Advantages vs. Paid Tools
• Cost
• Flexibility
• People know the tool

Wednesday, October 16, 13
Advantages vs. Paid Tools
• Cost
• Flexibility
• People know the tool
• Multi-page flows

Wednesday, October 16, 13
Advantages vs. Paid Tools
• Cost
• Flexibility
• People know the tool
• Multi-page flows
• Scripting

Wednesday, October 16, 13
Our Use Cases

Wednesday, October 16, 13
WebPagetest

Wednesday, October 16, 13

Catchpoint
WebPagetest
• Multi-page flows

Wednesday, October 16, 13

Catchpoint
WebPagetest
• Multi-page flows
• Scripted tests

Wednesday, October 16, 13

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

Wednesday, October 16, 13

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

Wednesday, October 16, 13

Catchpoint
WebPagetest

Catchpoint

• Multi-page flows

• DNS

• Scripted tests
• High volume testing
• Ad-hoc tests

Wednesday, October 16, 13
WebPagetest

Catchpoint

• Multi-page flows

• DNS

• Scripted tests

• API

• High volume testing
• Ad-hoc tests

Wednesday, October 16, 13
WebPagetest

Catchpoint

• Multi-page flows

• DNS

• Scripted tests

• API

• High volume testing

• Single Object Tests

• Ad-hoc tests

Wednesday, October 16, 13
WebPagetest

Catchpoint

• Multi-page flows

• DNS

• Scripted tests

• API

• High volume testing

• Single Object Tests

• Ad-hoc tests

• Multiple locations

Wednesday, October 16, 13
WebPagetest

Catchpoint

• Multi-page flows

• DNS

• Scripted tests

• API

• High volume testing

• Single Object Tests

• Ad-hoc tests

• Multiple locations
• Comparisons

Wednesday, October 16, 13
Future Work

Wednesday, October 16, 13
Improving the Process

Wednesday, October 16, 13
Improving the Process
• Manage disk space

Wednesday, October 16, 13
Improving the Process
• Manage disk space
• Multiple regions

Wednesday, October 16, 13
Improving the Process
• Manage disk space
• Multiple regions
• More canned scripts

Wednesday, October 16, 13
Improving the Process
• Manage disk space
• Multiple regions
• More canned scripts
• Automate upgrades

Wednesday, October 16, 13
Leveraging WebPagetest

Wednesday, October 16, 13
Leveraging WebPagetest
• Front-end SPOF

Wednesday, October 16, 13
Leveraging WebPagetest
• Front-end SPOF
• User Timings (AFT)

Wednesday, October 16, 13
Leveraging WebPagetest
• Front-end SPOF
• User Timings (AFT)
• Speed Index

Wednesday, October 16, 13
Wednesday, October 16, 13
Improving
WebPagetest

Wednesday, October 16, 13
WebPagetest + Vagrant

Wednesday, October 16, 13
WebPagetest + Vagrant
• Install VirtualBox

Wednesday, October 16, 13
WebPagetest + Vagrant
• Install VirtualBox
• Install Vagrant

Wednesday, October 16, 13
WebPagetest + Vagrant
• Install VirtualBox
• Install Vagrant
• https://gist.github.com/jklein/6992296

Wednesday, October 16, 13
WebPagetest + Vagrant
• Install VirtualBox
• Install Vagrant
• https://gist.github.com/jklein/6992296
•vagrant up

Wednesday, October 16, 13
WebPagetest + Vagrant
• Install VirtualBox
• Install Vagrant
• https://gist.github.com/jklein/6992296
•vagrant up
• http://localhost:8080

Wednesday, October 16, 13
Wednesday, October 16, 13
800MB

Wednesday, October 16, 13
webpagetest-api

Wednesday, October 16, 13
Wednesday, October 16, 13
Both Are Good Options

Wednesday, October 16, 13
Results > Tools

Wednesday, October 16, 13
Thanks!

Wednesday, October 16, 13
Get in Touch
@jonathanklein
jonathan@etsy.com
www.etsy.com/careers
Wednesday, October 16, 13

More Related Content

DIY Synthetic: Private WebPagetest Magic