59
CLIENT-SIDE PERFORMANCE TESTING Anand Bagmar Software Quality Evangelist

Client-Side Performance Testing

Embed Size (px)

Citation preview

Page 1: Client-Side Performance Testing

CLIENT-SIDE PERFORMANCE TESTING

Anand Bagmar

Software Quality Evangelist

Page 2: Client-Side Performance Testing

ABOUT ME

@BagmarAnand

Blog - essenceoftesting

about.me/anand.bagmar

Page 3: Client-Side Performance Testing

WHAT DO YOU EXPECT FROM THIS WORKSHOP?

Page 4: Client-Side Performance Testing

Why do we have to think about, or, do

Performance Testing?

Page 5: Client-Side Performance Testing

https://www.crazyegg.com/blog/speed-up-your-website/

Page 6: Client-Side Performance Testing

https://www.crazyegg.com/blog/speed-up-your-website/

Page 7: Client-Side Performance Testing

What is

Performance Testing?

Page 8: Client-Side Performance Testing

https://en.wikipedia.org/wiki/Software_performance_testing

Page 9: Client-Side Performance Testing

What is

Performance Engineering?

Page 10: Client-Side Performance Testing

https://en.wikipedia.org/wiki/Performance_engineering

Page 11: Client-Side Performance Testing

Techniques to improve Performance

Page 12: Client-Side Performance Testing

TECHNIQUES TO IMPROVE PERFORMANCE

We need to understand, and optimize

¨ Architecture, and

¨ How content gets delivered to the end-user

Page 13: Client-Side Performance Testing

CDN – Content Delivery Network

Page 14: Client-Side Performance Testing

https://en.wikipedia.org/wiki/Content_delivery_network

Page 15: Client-Side Performance Testing

How does CDN work?

Page 16: Client-Side Performance Testing

http://www.slideshare.net/gsluthra/harnessing-the-power-of-cdns

Page 17: Client-Side Performance Testing

http://www.slideshare.net/gsluthra/harnessing-the-power-of-cdns

Page 18: Client-Side Performance Testing

http://www.slideshare.net/gsluthra/harnessing-the-power-of-cdns

Page 19: Client-Side Performance Testing

By Kanoha - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=7868809

CDN DISTRIBUTION NETWORK

Page 20: Client-Side Performance Testing

This work great, but ...

Page 21: Client-Side Performance Testing

Are there any problems / limitations

of CDNs?

Page 22: Client-Side Performance Testing

Caching!In computing, a cache (/ˈkæʃ/ KASH) is a component that stores

data so future requests for that data can be served faster; the data stored in a cache might be the results of an earlier computation, or

the duplicates of data stored elsewhere.

Page 23: Client-Side Performance Testing
Page 24: Client-Side Performance Testing
Page 25: Client-Side Performance Testing
Page 26: Client-Side Performance Testing
Page 27: Client-Side Performance Testing

WHY CDN?

¨ Caching: Reduced Page Construction Time

¨ Closer: Reduced Latency

¨ Traffic Offloaded: Reduced Loads

¨ Backup: Served even if site is down

¨ Protection: Prevent DoS Attacks

¨ Others: Redirects/Auto-compression/Best-route detection

Page 28: Client-Side Performance Testing

Where can caching be done?

Page 29: Client-Side Performance Testing

TYPICAL ARCHITECTURE

Page 30: Client-Side Performance Testing

Lets draw!

Page 31: Client-Side Performance Testing

TYPICAL ARCHITECTURE

Improve user experienceReduce server load

Page 32: Client-Side Performance Testing

TYPES OF CACHES

¨ Web browser

¨ Proxy

¨ CDNs

¨ Reverse Proxies

¨ Web Server’s / Specialized Caches

Page 33: Client-Side Performance Testing

WE WILL FOCUS ON

Improve user experienceReduce server load

Page 34: Client-Side Performance Testing

Client-side Performance Testing

Page 35: Client-Side Performance Testing

To fix performance issues, we need to be able to measure it first!

Page 36: Client-Side Performance Testing

Measuring Client-side Performance

Page 37: Client-Side Performance Testing

MEASURING CLIENT SIDE PERFORMANCE

Synthetic Monitoring (& Testing)

Ø WebPageTest.org

Ø SiteSpeed.io

Ø ShowSlow

Ø Google PageSpeed

Ø Chrome Developer Tools

Page 38: Client-Side Performance Testing

MEASURING CLIENT SIDE PERFORMANCE

Real User Monitoring

Ø Akamai RUM

Ø Monitis RUM

Ø Google Analytics

Page 39: Client-Side Performance Testing

WebPageTest

Page 40: Client-Side Performance Testing

WEBPAGETEST – HOSTED SOLUTION

Advantages

Ø Free to use

Ø Global spread

Ø Caters to current web development practices / approaches (responsive / lazy loading / etc.)

Page 41: Client-Side Performance Testing

https://www.webpagetest.org/

Page 42: Client-Side Performance Testing

IMPORTANT METRICS

What to Measure?

WebPageTestMetric

Explanation

First reaction

Time to First Byte (TTFB)

Time from the start of the initial navigation until the first byte of the base page is received by the browser (after following redirects).

Content appears

Time to Start Render

Time from the start of the initial navigation until the first non-white content is painted to the browser display.

Pageprocessing completed

DOM Content Ready End

The point when the HTML parser has reached the end of the document which means it has executed any blocking scripts. The CSSOM may not be complete yet.

Full page loaded

Doc Complete Time

The onload event which fires when all of the scripts, css and images defined in the HTML have finished loading (including below-the-fold content).

Refer to WebPageTest documentation for more details:• https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/metrics• https://sites.google.com/a/webpagetest.org/docs/advanced-features/raw-test-results

Page 43: Client-Side Performance Testing

WEBPAGETEST – HOSTED SOLUTION

Disadvantages

Ø Need to get in the queue of currently executing tests

Ø Can run only against publically available URLs / pages

Ø Limited automation using REST APIs

Page 44: Client-Side Performance Testing

WEBPAGETEST – PRIVATE INSTANCE

Advantages

Ø Free to use, Open-source

Ø Can run multiple scenarios in parallel (limited by number of agents configured)

Ø Can run against public and private available URLs / pages

Ø Results available for as long as configured

Ø There is no limit on number of tests run per day

Page 45: Client-Side Performance Testing

WEBPAGETEST – PRIVATE INSTANCE

Disadvantages

Ø Need to setup the WPT server and WPT agents in our own infrastructure, or in AWS

Page 46: Client-Side Performance Testing

WEBPAGETEST - AUTOMATION

Ø REST API calls

Ø Poll for results / implement call back

Ø Parse summary / detail CSV file to do assertions / validations

Challenges

Ø Managing infrastructure

Ø Polling for results can be time consuming and error prone

Page 47: Client-Side Performance Testing

YSlow

Page 48: Client-Side Performance Testing

YSLOW

Advantages

Ø Simple to use (with phantomJS)

Ø Gives reasonably decent information

Ø Easy to hook with Continuous Integration (CI) Server

Page 49: Client-Side Performance Testing

http://phantomjs.org/download.html

https://github.com/anandbagmar/client-side-perf-tests

Page 50: Client-Side Performance Testing

YSLOW

Disadvantages

Ø OLD

Ø Does not consider lazy loading / responsive design

Page 51: Client-Side Performance Testing

Chrome Developer Tools

Page 52: Client-Side Performance Testing

https://developers.google.com/web/tools/chrome-devtools/

Page 53: Client-Side Performance Testing

https://developers.google.com/web/tools/chrome-devtools/

Page 54: Client-Side Performance Testing

Google’s PageSpeedScore

Page 55: Client-Side Performance Testing

https://developers.google.com/speed/pagespeed/insights/

Page 56: Client-Side Performance Testing

https://developers.google.com/speed/pagespeed/insights/

Page 57: Client-Side Performance Testing

GOOGLE PAGE SPEED

Ø De facto standard

Ø Shows opportunities to increase page speed score

Ø Works only for public URLs / pages

Page 58: Client-Side Performance Testing

RESOURCES

Ø www.webpagetest.org

Ø Page Speed

Ø PhantomJS – YSlow

Ø Sample automation –client-side-perf-tests

Ø Chrome Developer Tools

Page 59: Client-Side Performance Testing

@BagmarAnand

Blog - essenceoftesting

about.me/anand.bagmar

THANK YOU