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

Developer-Friendly Web Performance Testing in Continuous

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Developer-Friendly Web Performance Testing in Continuous

Developer-FriendlyWeb Performance Testing in Continuous Integration

Michael Klepikov, Google

Velocity Conference, London, 2013

Page 2: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

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: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

Dedicated Perf Tests RotUI evolves

Tests break

Who fill fix?

Page 7: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

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: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

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: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

Graphs !

Detect regressions

Drill down

RUM metrics from UI tests

Page 14: Developer-Friendly Web Performance Testing in Continuous

● 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: Developer-Friendly Web Performance Testing in Continuous

Performance Test Lifecycle Add Instrumentation

Reportingto your (web) app

Continuous Performance Tests

Real User Monitoring

Push to Production

Regression AlertsFix

Page 16: Developer-Friendly Web Performance Testing in Continuous

Perf tests run longer: two CBs

Main CB Perf CBgreen builds

bisect the culprit

Page 17: Developer-Friendly Web Performance Testing in Continuous

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: Developer-Friendly Web Performance Testing in Continuous

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: Developer-Friendly Web Performance Testing in Continuous

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