Scaling WordPress With Load Testing

Scaling WordPress With Load Testing

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.

However, most people don’t even bother to load test their sites. And of those who do, a number tend to only run basic tests 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, we 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

October 21, 2016
Tweet

Transcript

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

  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. ApacheBench Output Server Software: nginx Server Hostname: jasoncosper.com Server Port:

    443 SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,4096,256 Document Path: / Document Length: 31927 bytes Concurrency Level: 10 Time taken for tests: 34.163 seconds Complete requests: 100 Failed requests: 0 Total transferred: 3253000 bytes HTML transferred: 3192700 bytes Requests per second: 2.93 [#/sec] (mean) Time per request: 3416.350 [ms] (mean) Time per request: 341.635 [ms] (mean, across all concurrent requests) Transfer rate: 92.99 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 244 259 18.5 253 343 Processing: 483 3015 2104.7 2566 11495 Waiting: 479 3011 2104.9 2564 11491 Total: 754 3274 2105.9 2813 11766 Percentage of the requests served within a certain time (ms) 50% 2813 66% 3673 75% 4369 80% 4677 90% 6319 95% 7818 98% 9886 99% 11766 100% 11766 (longest request)
  15. If you have macOS you have ApacheBench

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

    work: apt install apache2-utils
  17. h2load

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

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

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

    h2load send 500 requests to two URLs with 100 concurrent clients. And please don't go over 10 concurrent streams.
  21. h2load Output starting benchmark... spawning thread #0: 100 total client(s).

    500 total requests TLS Protocol: TLSv1.2 Cipher: ECDHE-RSA-AES256-GCM-SHA384 Server Temp Key: ECDH P-256 256 bits Application protocol: h2 finished in 100.52s, 4.97 req/s, 143.56KB/s requests: 500 total, 500 started, 500 done, 500 succeeded, 0 failed, 0 errored, 0 timeout status codes: 500 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 14.09MB (14776906) total, 208.11KB (213106) headers (space savings 21.04%), 13.86MB (14531900) data min max mean sd +/- sd time for request: 442.43ms 100.21s 42.23s 26.80s 61.80% time for connect: 236.00ms 301.97ms 268.62ms 19.25ms 63.00% time to 1st byte: 678.74ms 46.08s 13.66s 9.60s 69.00% req/s : 0.05 0.12 0.07 0.02 74.00%
  22. Installing h2load https://boogah.org/inst-h2load

  23. JMeter

  24. None
  25. 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.
  26. Installing JMeter https://boogah.org/inst-jmeter

  27. Creating test plans is easyish

  28. Don't test production environments from your laptop

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

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

  31. Real world scenarios

  32. Google Analytics is your friend

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

  35. Bringing it all together

  36. 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.
  37. YMMV

  38. Okay, but how many users?

  39. Push it to the limit

  40. My limit seems kinda low

  41. Questions?

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