Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

Let's talk about performance testing

Slide 3

Slide 3 text

Why load test?

Slide 4

Slide 4 text

Common styles of performance testing

Slide 5

Slide 5 text

Stress testing

Slide 6

Slide 6 text

Spike testing

Slide 7

Slide 7 text

Endurance testing

Slide 8

Slide 8 text

Configuration testing

Slide 9

Slide 9 text

YMMV

Slide 10

Slide 10 text

Tools

Slide 11

Slide 11 text

ApacheBench

Slide 12

Slide 12 text

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.

Slide 13

Slide 13 text

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.

Slide 14

Slide 14 text

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)

Slide 15

Slide 15 text

If you have macOS you have ApacheBench

Slide 16

Slide 16 text

Installing ApacheBench If you're using Ubuntu to do your development work: apt install apache2-utils

Slide 17

Slide 17 text

h2load

Slide 18

Slide 18 text

h2load > ApacheBench » HTTP/2 and HTTP/1.1 support out-of-the-box! » It's multithreaded! » Support for more than one URL!

Slide 19

Slide 19 text

h2load Gotchas » Limited actionable data. » Not a real browser test. » Best run from the same server as your site.

Slide 20

Slide 20 text

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.

Slide 21

Slide 21 text

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%

Slide 22

Slide 22 text

Installing h2load https://boogah.org/inst-h2load

Slide 23

Slide 23 text

JMeter

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

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.

Slide 26

Slide 26 text

Installing JMeter https://boogah.org/inst-jmeter

Slide 27

Slide 27 text

Creating test plans is easyish

Slide 28

Slide 28 text

Don't test production environments from your laptop

Slide 29

Slide 29 text

Flood IO https://flood.io/

Slide 30

Slide 30 text

BlazeMeter https://www.blazemeter.com/

Slide 31

Slide 31 text

Real world scenarios

Slide 32

Slide 32 text

Google Analytics is your friend

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Useful Filters » ?s » product » category » tag

Slide 35

Slide 35 text

Bringing it all together

Slide 36

Slide 36 text

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.

Slide 37

Slide 37 text

YMMV

Slide 38

Slide 38 text

Okay, but how many users?

Slide 39

Slide 39 text

Push it to the limit

Slide 40

Slide 40 text

My limit seems kinda low

Slide 41

Slide 41 text

Questions?

Slide 42

Slide 42 text

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