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.

Jason Cosper

March 25, 2017
Tweet

More Decks by Jason Cosper

Other Decks in Technology

Transcript

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

    View Slide

  2. Let's talk about
    performance testing

    View Slide

  3. Why load test?

    View Slide

  4. Common styles of
    performance testing

    View Slide

  5. Stress testing

    View Slide

  6. Spike testing

    View Slide

  7. Endurance testing

    View Slide

  8. Configuration testing

    View Slide

  9. YMMV

    View Slide

  10. Tools

    View Slide

  11. ApacheBench

    View Slide

  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.

    View Slide

  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.

    View Slide

  14. If you have macOS
    you have ApacheBench

    View Slide

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

    View Slide

  16. h2load

    View Slide

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

    View Slide

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

    View Slide

  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.

    View Slide

  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%

    View Slide

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

    View Slide

  22. JMeter

    View Slide

  23. View Slide

  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.

    View Slide

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

    View Slide

  26. Creating test plans
    is easyish

    View Slide

  27. Don't test production environments
    from your laptop

    View Slide

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

    View Slide

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

    View Slide

  30. Real world
    scenarios

    View Slide

  31. Google Analytics
    is your friend

    View Slide

  32. View Slide

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

    View Slide

  34. Bringing it
    all together

    View Slide

  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.

    View Slide

  36. YMMV

    View Slide

  37. Okay, but
    how many users?

    View Slide

  38. Push it
    to the limit

    View Slide

  39. My limit
    seems kinda low

    View Slide

  40. Questions?

    View Slide

  41. Thanks!

    View Slide

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

    View Slide