webpagetest - good, bad & ugly

37
Using the WebPagetest API WebPagetest: The Good, The Bad & The Ugly

Upload: turbobytes

Post on 02-Dec-2014

4.865 views

Category:

Technology


0 download

DESCRIPTION

Presentation by @aaronpeters at Dutch Web Performance Meetup on August 22 2012. The presentation covers new stuff in WPT UI, the WPT API, scripting and hidden gems. Awesome tool, but also room for improvement.

TRANSCRIPT

Page 1: WebPagetest - Good, Bad & Ugly

Using the WebPagetest APIWebPagetest:

The Good, The Bad & The Ugly

Page 2: WebPagetest - Good, Bad & Ugly

1 First … some basic tips

Page 3: WebPagetest - Good, Bad & Ugly

Understand the test environmentWindows version? DNS resolver?

Hardware specs (RAM, processor)?

Page 4: WebPagetest - Good, Bad & Ugly

Run a large number of tests

Page 5: WebPagetest - Good, Bad & Ugly

Collect RUM data too !

Page 6: WebPagetest - Good, Bad & Ugly

Summary statistics hide insight

Mean: ~1400 msMedian: ~1100 ms

Page 8: WebPagetest - Good, Bad & Ugly

New stuff in the WPT ui2

Page 9: WebPagetest - Good, Bad & Ugly

Homepage > Advanced tab

Page 10: WebPagetest - Good, Bad & Ugly

Capture Network Log (Chrome)Returns big TXT file with JSON … then what?

Pat: “You probably don't want to use the network log - it was added for the Chrome team themselves to debug the browser :-)”

Page 11: WebPagetest - Good, Bad & Ugly

Minimum test durationIt works, kindof ...

Example (minTestDur=45)

Page 12: WebPagetest - Good, Bad & Ugly

WPT API introduction3

Page 13: WebPagetest - Good, Bad & Ugly

Getting started

Get an API key from Pat (required)

Basic process:

1. Submit request via POST or GET

2. Poll for the test status (or use pingback)

3. Fetch test results

4. Fetch objects (charts, screen shots, ...)

Know your requests will have low prio /getLocations.php

Page 14: WebPagetest - Good, Bad & Ugly

Submitting requests

Send a POST or GET to http://www.webpagetest.org/runtest.php

url is only required parameter

Defaults: Dulles DSL, 1 run, first & repeat view, public, no video

Overview of parameters

Page 15: WebPagetest - Good, Bad & Ugly

Results

Example XML

It has it all, incl.

1. PageSpeed version & results

2. Page <title>

3. Links to pages/files for everything in UI

4. Video frame URLs & Speed Index score !

Page 17: WebPagetest - Good, Bad & Ugly

Scripting4

Page 18: WebPagetest - Good, Bad & Ugly

Lots of possibilities!

Navigation/DOM interaction (submitForm)

End Conditions (setDOMelement)

Request Manipulation (setDNS)

Misc (combineSteps)

Great for simulating user-page interaction, multi-page testing and different 'conditions'

https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/scripting

Page 19: WebPagetest - Good, Bad & Ugly

Example scripts

logData 0navigate http://www.gamesgames.com/logData 1navigate http://www.gamesgames.com/search.html?

search=bloons+4

SetDNSName cdn.domain.com www.domain.comoverrideHost cdn.domain.com www.domain.comnavigate www.domain.com

Page 20: WebPagetest - Good, Bad & Ugly

Commands you'll likely useCommand Descriptionnavigate Navigate to next page, wait for it to completelogData Set to 0 to not record anything; 1 = record!setValue Sets the value attribute of the given DOM element to the

provided value.submitForm Triggers a submit event for the identified form.setDOMElement Sets the attribute of a DOM element that is required for

the next event to complete successfully.block Blocks individual requests from loadingcombineSteps Causes multiple script steps to be combined into a single

"step" in the resultssetViewportSize Changes size of visible browser windowfirefoxPref Allows you to specify arbitrary preferences that will be

configured before launching the browser. Eg. firefoxPref network.http.pipelining false

setDNS Allows for overriding the IP address for a host name.

Page 21: WebPagetest - Good, Bad & Ugly

Why did the test fail?Can be very hard to troubleshoot, esp. on large scripts

Page 22: WebPagetest - Good, Bad & Ugly

5 WPT – hidden gems

Page 23: WebPagetest - Good, Bad & Ugly

&[email protected]

e-mail address to notify with the test results

Page 25: WebPagetest - Good, Bad & Ugly

&pngss=1

Set to 1 to save a full-resolution version of the fully loaded screen shot as a png

Normal JPG

Big PNG24

Page 26: WebPagetest - Good, Bad & Ugly

&f=json

Format. Set to "xml" to request an XML response instead of a redirect ("json" is also provisionally supported)

Page 27: WebPagetest - Good, Bad & Ugly

&plr=50

Packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)

plr=0

plr=50

No diff !Location specific issue?

Page 28: WebPagetest - Good, Bad & Ugly

console.log() outputCan be found on the screen shots page ...

Example

Page 29: WebPagetest - Good, Bad & Ugly

Time to TitleNot in UI, but ís in results from API: <titleTime>

Example

Can also be found in “Raw Page data” CSV

Page 30: WebPagetest - Good, Bad & Ugly

Closing remarks6

Page 31: WebPagetest - Good, Bad & Ugly

WPT can act … surprising

Page 32: WebPagetest - Good, Bad & Ugly

The documentation may not help out

Page 33: WebPagetest - Good, Bad & Ugly

It may drive you mad

Page 34: WebPagetest - Good, Bad & Ugly

Don't give up easily

Page 35: WebPagetest - Good, Bad & Ugly

Put some effort in!

Page 36: WebPagetest - Good, Bad & Ugly

Be the Success Kid!

Page 37: WebPagetest - Good, Bad & Ugly