19
Developer-Friendly Web Performance Testing in Continuous Integration Michael Klepikov, Google Velocity Conference, London, 2013

Velocity 2013 london developer-friendly web performance testing in continuous integration

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Developer-FriendlyWeb Performance Testing in Continuous Integration

Michael Klepikov, Google

Velocity Conference, London, 2013

Page 2: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Web performance testing is hard

● Sidelines of web app lifecycle

● Move to mainstream

● Integrate with main UI continuous build

● Make fixes cheaper

Overview

Page 3: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Many awesome perf test tools

○ WebPageTest.org

● Domain of few experts

● High maintenance

● Hard to add to regular continuous build

Perf testing on sidelines

Page 4: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Why hard to integrate?● Focus on browser only

○ No control of server start/stop

○ CB must run at a specific changelist

● Own test scheduler (e.g. WebPageTest)

○ Impedance mismatch with main CB scheduler

Page 5: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Complex end to end system

○ Regression could be anywhere, not just browser

● Hard to find the culprit change

○ 100’s-1000’s of developer changes + cherrypicks

● Production release logistics

Expensive to fix production

Page 6: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Dedicated Perf Tests RotUI evolves

Tests break

Who fill fix?

Page 7: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Pervasive adoption in web UI tests

● All major browsers, desktop and mobile○ W3C standard

● No direct support for perf testing○ Bad idea to measure around Selenium/WD API calls

Selenium 2.0 - WebDriver

Page 8: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Real User Monitoring● Self-instrumentation + reporting in JS

● Arguably more important than perf testing

● Track metrics that matter

● Interactive pages (page-load meaningless)

● Easier to attribute than page-load time

Page 9: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● UI tests trigger RUM

● Intercept metrics

○ and DevTools traces

● UI tests stay green○ keep perf tests green

Perf tests that ride on UI tests

Page 10: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Collect DevTools traces● Selenium Logging API: LogType.PERFORMANCE

● Save in test results

● Compare before vs. after traces

○ Great aid for debugging regressions

● Test infrastructure does it transparently

Page 11: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Parse from the saved DevTools trace

○ …/report?a=10,b=220

● Store to a database

○ Time Series of Time Series: changelists, iterations

● Graph, autodetect regressions○ TSViewDB

Intercept RUM metrics

Page 12: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Run many iterations of same UI test

○ At the same changelist

● Statistically viable

○ Keep in mind – the distribution is not normal!

● Test infrastructure does it transparently

Iterations

Page 13: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Graphs !

Detect regressions

Drill down

RUM metrics from UI tests

Page 14: Velocity 2013 london  developer-friendly web performance testing in continuous integration

● Don’t schedule tests on WPT

● Send perf test results to WPT server

○ Awesome UI, lots of useful analysis for free

● Link from main test results UI to WPT page

● TSViewDB integration, with drill-down

WebPageTest: results UI only

Page 15: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Performance Test Lifecycle Add Instrumentation

Reportingto your (web) app

Continuous Performance Tests

Real User Monitoring

Push to Production

Regression AlertsFix

Page 16: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Perf tests run longer: two CBs

Main CB Perf CBgreen builds

bisect the culprit

Page 17: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Caveats● Do not predict absolute production latency!

○ Ideally server under test runs in isolation in CB

○ Limited variety of hardware, networks

● Only detect regressions

○ E.g. daily regression summary email

Page 18: Velocity 2013 london  developer-friendly web performance testing in continuous integration

Conclusions● Use UI functional tests as a base

● Intercept RUM, run many iterations

● Run continuously!

● Autodetect regressions, CL author to fix!

● Debug production less!

Page 19: Velocity 2013 london  developer-friendly web performance testing in continuous integration

These slides: goo.gl/HdUCqL

Intercept DevTools: youtu.be/0_kAPWSZNY4

Send results to WPT: gist.github.com/klepikov

TSViewDB: github.com/google/tsviewdb

Q&A