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

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.

Jason Cosper

October 21, 2016
Tweet

More Decks by Jason Cosper

Other Decks in Technology

Transcript

  1. 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.
  2. 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.
  3. 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)
  4. h2load > ApacheBench » HTTP/2 and HTTP/1.1 support out-of-the-box! »

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

    browser test. » Best run from the same server as your site.
  6. 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.
  7. 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%
  8. 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.
  9. 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.