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

Scaling WordPress with Load Testing (March 2017)

Scaling WordPress with Load Testing (March 2017)

Everybody wants their site to be scalable. From shared hosting customers to large media companies on expensive dedicated hardware, people deserve to get every last bit of performance that they’ve paid for. A great first step is to do load testing. However, most of the people running tests tend to only do so on their local machine. To truly understand what you can reasonably expect, you need to throw real traffic (and real scenarios) at your production environment. In this session I will discuss how to generate tests that mimic realistic user traffic, ways to run these tests against your site, and what to do after you realize things maybe aren’t as fast as you’d thought.

37169c5c58e9add105cda1c63584b9f3?s=128

Jason Cosper

March 25, 2017
Tweet

Transcript

  1. Scaling WordPress With Load Testing https://boogah.org/wcsd17

  2. Let's talk about performance testing

  3. Why load test?

  4. Common styles of performance testing

  5. Stress testing

  6. Spike testing

  7. Endurance testing

  8. Configuration testing

  9. YMMV

  10. Tools

  11. ApacheBench

  12. ApacheBench Gotchas » Single threaded. » Not good for benchmarking

    high capacity servers. » Works best when run from the same server as your site. » Can only hit one URL at a time. » Not much actionable data. » Not a real browser test. » No HTTP/2 support.
  13. Using ApacheBench ab -n 100 -c 10 https://jasoncosper.com/ Translation: Have

    ApacheBench send 100 requests to my site. There should be no more than 10 requests running concurrently.
  14. If you have macOS you have ApacheBench

  15. Installing ApacheBench If you're using Ubuntu to do your development

    work: apt install apache2-utils
  16. h2load

  17. h2load > ApacheBench » HTTP/2 and HTTP/1.1 support out-of-the-box! »

    It's multithreaded! » Support for more than one URL!
  18. h2load Gotchas » Limited actionable data. » Not a real

    browser test. » Best run from the same server as your site.
  19. Using h2load h2load -n1000 -c100 -m10 https://jasoncosper.com/ https://jasoncosper.com/podcasts/ Translation: Have

    h2load send 1000 requests to two URLs with 100 concurrent clients. And please don't go over 10 concurrent streams.
  20. h2load Output finished in 7.43s, 134.60 req/s, 3.48MB/s requests: 1000

    total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 25.85MB (27110684) total, 484.65KB (496284) headers (space savings 21.07%), 25.33MB (26555500) data min max mean sd +/- sd time for request: 273.54ms 6.27s 1.90s 1.13s 67.70% time for connect: 1.09s 4.21s 1.98s 723.85ms 63.00% time to 1st byte: 1.49s 4.84s 2.53s 792.93ms 66.00% req/s : 1.35 4.30 2.11 0.56 80.00%
  21. Installing h2load https://boogah.org/inst-h2load

  22. JMeter

  23. None
  24. Apache JMeter » Created to test production web apps. »

    Ridiculously configurable and extendable. » Cross-platform (Mac, Windows, Linux) » Fully multithreaded. » GUI and CLI. » Distributed remote testing support.
  25. Installing JMeter https://boogah.org/inst-jmeter

  26. Creating test plans is easyish

  27. Don't test production environments from your laptop

  28. Flood IO https://flood.io/

  29. BlazeMeter https://www.blazemeter.com/

  30. Real world scenarios

  31. Google Analytics is your friend

  32. None
  33. Useful Filters » ?s » product » category » tag

  34. Bringing it all together

  35. WooCommerce Test Plans » Browse site. » Browse site, perform

    multiple searches. » Add products to cart, check out. » Log in, browse site. » Log in, visit "My Account" page. » Log in, add products to cart, check out.
  36. YMMV

  37. Okay, but how many users?

  38. Push it to the limit

  39. My limit seems kinda low

  40. Questions?

  41. Thanks!

  42. @boogah https://jasoncosper.com/ https://hipsum.co/