Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to Think Like a Performance Engineer

How to Think Like a Performance Engineer

As awareness and tooling around site speed have been improving at a very exciting rate, has performance testing actually become any easier? Any more straightforward? As someone who spends every day auditing client projects, I think areas of confusion have actually increased in many places. Which tools should we be using? Can we trust them? How do we run tests that serve as realistic and actionable predictors? And how do we know when we’ve won?

In this talk, we’ll look at highly practical tools and workflows to ensure that every test we run has a purpose and gives us data we can truly leverage. By the end, we will all have a shared idea of what effective performance testing looks like, as well as customised and fine-tuned tooling to ensure replicable and predictable tests.

Harry Roberts

July 17, 2024
Tweet

More Decks by Harry Roberts

Other Decks in Technology

Transcript

  1. “While a good TTFB doesn ’ t necessarily mean you

    will have a fast website, a bad TTFB almost certainly guarantees a slow one.” — csswz.it/ttfb
  2. api calls, application runtime, cdn features, cheap hosting, ddos or

    heavy load, dns, database queries, filesystem reads, last-mile latency, latency, prioritisation, redirects, routing, server-side rendering, tcp, tls, wafs and load balancers
  3. K E Y T A K E A W A

    Y domcontentloaded fires after deferred js has finished running
  4. W A R N I N G core web vitals

    are too broad for localhost
  5. lcp

  6. <script> performance.mark('cssStart'); </script> <link rel=stylesheet href=app.css> <script> performance.mark('cssEnd'); const cssTime

    = performance.measure('cssTime', 'cssStart', 'cssEnd'); console.log(cssTime.duration); </script>
  7. <script> performance.mark('cssStart'); </script> <style>/*! app.css */</style> <script> performance.mark('cssEnd'); const cssTime

    = performance.measure('cssTime', 'cssStart', 'cssEnd'); console.log(cssTime.duration); </script>
  8. K E Y T A K E A W A

    Y custom timings better capture the bare-metal impact of your work
  9. “Data from ATI also confirms that BBC.com had […] 1.5

    billion page views […] in March 2020.” — bit.ly/3S8xexY
  10. you should know your own urls: source them from search

    console, analytics, commercial importance
  11. 3.2

  12. score di ff erence (+) 3g fast 8.715 5.515 4g

    6.230 3.030 4g fast 5.280 2.080 lte 5.018 1.818 cable 5.670 2.470
  13. K E Y T A K E A W A

    Y most tools’ defaults are too pessimistic; try align lab tests with field data
  14. K E Y T A K E A W A

    Y important to test, but don’t over-focus on cold-start
  15. K E Y T A K E A W A

    Y cold starts should be your least frequent scenarios
  16. K E Y T A K E A W A

    Y cold starts are your most pessimistic scenario
  17. K E Y T A K E A W A

    Y cold starts tend to show your most obvious issues
  18. // Add something to localStorage before // the app needs

    to read it back out. localStorage.setItem('key', 'value');
  19. W A R N I N G this is still

    an unlikely (i.e. cold-start) scenario
  20. W A R N I N G even this isn’t

    the same as a real user clicking around
  21. api calls, application runtime, cdn features, cheap hosting, ddos or

    heavy load, dns, database queries, filesystem reads, last-mile latency, latency, prioritisation, redirects, routing, server-side rendering, tcp, tls, wafs and load balancers
  22. api calls, application runtime, cdn features, cheap hosting, ddos or

    heavy load, dns, database queries, filesystem reads, last-mile latency, latency, prioritisation, redirects, routing, server-side rendering, tcp, tls, wafs and load balancers
  23. W A R N I N G you can’t use

    the navigate command with spa
  24. setEventName Home // Trigger hard navigation navigate %URL% setEventName About

    // Trigger soft navigation execAndWait \ document.querySelector('[href=about/]').click()
  25. K E Y T A K E A W A

    Y the numbers you see represent a huge array of experiences…
  26. K E Y T A K E A W A

    Y …you can’t keep running one test
  27. K E Y T A K E A W A

    Y design tests that suit your context
  28. K E Y T A K E A W A

    Y test the right things under the right conditions and in the right scenarios
  29. K E Y T A K E A W A

    Y the fun stuff is the most well hidden