45
1 Web Performance Testing NoVa Test Automation Interest Group Patrick Meenan Twitter: @PatMeenan [email protected] blog.patrickmeenan.com

Web performance testing

Embed Size (px)

DESCRIPTION

Presentation from the October 2011 meeting of the Northern Virginia Test Automation Interest Group on testing web performance.

Citation preview

Page 1: Web performance testing

1

Web Performance TestingNoVa Test Automation Interest Group

Patrick MeenanTwitter: @[email protected]

Page 2: Web performance testing

Google Confidential and Proprietary

Front-End vs. Back-End

2

Page 3: Web performance testing
Page 4: Web performance testing

Back-End

This is the HTML that largely contains the content of the page and defines the structure.

Page 5: Web performance testing

Front-End

CSS : Layout and style

Images

Graphical Elements

Page 6: Web performance testing

Waterfall Diagram

Base PageCSS

Images and

Graphical

Elements

Javascript

Start Render Document Complete (onLoad)

Page 7: Web performance testing

Front-End vs Back-End

7

Base Page

Back-End Processing

Page 8: Web performance testing

8

Front-End: 3.2s* Back-End: 0.010s*

*WebPagetest performance as measured by New Relic

Page 9: Web performance testing

Google Confidential and Proprietary

Measuring Performance

9

Page 10: Web performance testing

velocityconf.com/velocity2011/public/schedule/detail/18039

Page 11: Web performance testing

Active Testing

Consistent results

• Good for detecting and diagnosing issues that are 100% repeatable and on pages you are monitoring

Lots of detail

Availability monitoring

Not representative of actual end-user performance

• Usually tested from data centers

• Sometimes co-located with CDN provider equipment

Page 12: Web performance testing

US Broadband Bandwidth

12www.fcc.gov/document/measuring-broadband-america-report-consumer-broadband-performance-us

Page 13: Web performance testing

US Broadband Latency

13www.fcc.gov/document/measuring-broadband-america-report-consumer-broadband-performance-us

Page 14: Web performance testing

Bandwidth/Latency Impact

14www.belshe.com/2010/05/24/more-bandwidth-doesnt-matter-much/

(Fixed 60ms RTT) (Fixed 5Mbps Bandwidth)

Page 15: Web performance testing

15

BackboneTesting

ActualUsers

Page 16: Web performance testing

16

DSL – Back-End: 17%

Backbone – Back-End: 52%

Page 17: Web performance testing

When is “Done”?

Easy answer is onLoad

But…

17

Page 18: Web performance testing

When is “Done”?

18

Twitter onLoad (1.9s) Twitter end of activity (6.8s)

Page 19: Web performance testing

Synthetic Browsers

Know HOW your active testing is done

• Some only test the base page

• Synthetic browsers usually not reflective of real browser

• Real browser testing

• Connectivity (backbone, last-mile)

www.engadget.com

• Synthetic Browser: 447 requests

• IE 8: 241 requests

Page 20: Web performance testing

Real User Monitoring (RUM)

Full coverage on all pages visited by users

Real performance information for end-user experience

No availability monitoring

Limited detail

• … but getting better

Page 21: Web performance testing

Navigation Timing – IE9, Chrome, Firefox 7

window.performance.timing

21dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html

Front-End

Back-End

Page 22: Web performance testing

Resource Timing (draft)

22w3c-test.org/webperf/specs/ResourceTiming/

Timing for every network-loaded resource

Page 23: Web performance testing

_gaq.push(['_trackPageLoadTime']);

Page 24: Web performance testing
Page 25: Web performance testing
Page 26: Web performance testing

Back-End Only

Page 27: Web performance testing

Google Confidential and Proprietary

Frontend Single Point Of Failure

27

Page 28: Web performance testing

Asynchronous Javascript

It’s not just good for web performance…

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

vs.

<script type="text/javascript">(function() {

var tw = document.createElement('script'); tw.type = 'text/javascript'; tw.async = true;tw.src = 'http://platform.twitter.com/widgets.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tw, s);

})();</script>

28

Page 29: Web performance testing

It prevents Frontend SPOF

29

User stares at a blank window for 21 seconds (usually < 2 seconds)

Page 30: Web performance testing

What it feels like

30

Page 31: Web performance testing

Testing for Frontend SPOF

blackhole.webpagetest.org (aka 72.66.115.13)

Hosts file:

72.66.115.13 ajax.googleapis.com72.66.115.13 apis.google.com72.66.115.13 www.google-analytics.com72.66.115.13 connect.facebook.net72.66.115.13 platform.twitter.com

WebPagetest.org:

setDnsName platform.twitter.com blackhole.webpagetest.orgnavigate your.url.com

31

Page 32: Web performance testing

Google Confidential and Proprietary

WebPagetest

32

Page 33: Web performance testing

The basics – testing “pages”

• www.webpagetest.org

• Submit an URL….

Page 34: Web performance testing

From multiple locations globally…

34

Page 35: Web performance testing

The basics – get “results”

Performance and optimization information

Page 36: Web performance testing

What it looks like

Page 37: Web performance testing

What it looks like

Page 38: Web performance testing

What if…

Page 39: Web performance testing

Comparing arbitrary tests

Page 40: Web performance testing

The comparison

Page 41: Web performance testing

More advanced capabilities

Automating Rich Applications

• Authenticating into form-protected applications

• Interacting with Web Apps (Mail, Calendar, etc)

• Testing a navigation flow from one page to another

• Execute arbitrary Javascript

REALLY Advanced Options

• Re-writing DNS lookups (directing traffic to a test/staging box)

• Custom User-Agent strings & HTTP Headers

• Pre-populating cookies

• Custom test end conditions

• Capture Dynatrace Ajax Edition sessions

• Tcpdump capture

41

Page 42: Web performance testing

Private Instances

http://sites.google.com/a/webpagetest.org/docs/private-instances

Bulk Testing

EC2 Agent Public AMI’s• US (East/West)

• Europe

• Asia (Singapore/Tokyo)

Public Projects• HTTP Archive

• Blaze Mobitest

Page 43: Web performance testing

REST API

Submit tests (API key required for public instance)

• Check status

• Fetch Result

1.XML

2.HAR

http://sites.google.com/a/webpagetest.org/docs/advanced-features/webpagetest-restful-apis

Page 44: Web performance testing

WPT Monitor Tony Perkins (Sabre)

http://www.webpagetest.org/forums/forumdisplay.php?fid=21

Page 45: Web performance testing

HTTP Archive

http://httparchive.org/

45