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

Un-Scaling WordPress

Un-Scaling WordPress

WordPress can scale from a few visitors per day to millions. While it can be complicated to get WordPress to run in a clustered setup, most sites don’t need this.

While developing WordPress managed hosting, one of the discoveries was that WordPress can not only scale, but it can handle millions of visits per month with a single web machine and MySQL.

I’ll walk through the basics of performance in WordPress, and what it takes to build a highly performing install on a single VPS + MySQL, dispelling the myth that it requires a large amount of resources to handle a huge amount of traffic with WordPress.

46fa959634a063abefcac94eaf191eca?s=128

Mike Schroder

July 14, 2017
Tweet

Transcript

  1. Un-Scaling WordPress WordCamp DC 2017 Mike Schroder Director of WordPress

    Strategy @ DreamHost @GetSource - https://getsource.net
  2. What does it mean to scale?

  3. Vertical scaling: More RAM and CPU.

  4. Horizontal scaling: More servers with the RAM and CPU.

  5. Vertical scaling

  6. Vertical scaling

  7. Horizontal scaling

  8. Horizontal scaling

  9. What does it mean to un-scale?

  10. None
  11. Simplified architecture.

  12. Let’s see what we can do with shared and a

    512mb VPS.
  13. How much RAM does WordPress need?

  14. Page View => ~3-120mb Image Operations => ~256mb+

  15. Does WordPress scale?

  16. Adjacent technologies help WordPress serve higher traffic sites well.

  17. We’re really talking about caching.

  18. If you’ve hit PHP, you’ve lost.

  19. But it’s not as bad as it used to be.

  20. Opcode cache.

  21. Usually OPcache, included with PHP 5.5+

  22. Higher percentage of improvement on hosts with low CPU resources.

  23. Test: ~100 users during 1 minute.

  24. Shared PHP 5.6 100/min Average: 1045ms

  25. Shared PHP 5.6 w/OPcache 100/min Average: 782ms

  26. Shared PHP 7 100/min Average: 760ms

  27. Shared PHP 7 w/OPcache 100/min Average: 507ms

  28. Persistent object caching.

  29. By default, WP’s internal cache expires with each request.

  30. Persistent object caching helps dynamic sites most.

  31. Usually this is Memcached or Redis.

  32. Front end caching.

  33. Save the final output of PHP.

  34. Disk, Varnish, Nginx.

  35. Front end caching helps static sites most.

  36. Shared PHP 7 w/OPcache + WP Super Cache PHP Routed:

    100/min Average: 69ms
  37. Like with “firewall” plugins, treat PHP-based solutions with skepticism.

  38. Shared PHP 7 w/OPcache + WP Super Cache Disk Backed:

    100/min Average: 32ms
  39. Shared PHP 7 w/OPcache + WP Super Cache Disk Backed:

    1000/min Average: 43ms
  40. Shared PHP 7 w/OPcache + WP Super Cache Disk Backed:

    5000/min Average: 2158ms
  41. Let’s take a look at our VPS.

  42. VPS PHP 7 w/OPcache 100/min Average: 169ms

  43. VPS PHP 7 w/OPcache + Varnish RAM Backed 100/min Average:

    21ms
  44. VPS PHP 7 w/OPcache + Varnish RAM Backed 5000/min Average:

    17ms
  45. 5000/min => 216,000,000/month

  46. How much RAM do adjacent services need?

  47. Basically anything helps for OPcache. So have some.

  48. 32-96mb for Memcached, with slab size > than options. (4mb

    is a good start)
  49. 128mb Varnish Have some VCL.
 https://github.com/tollmanz/varnish-vcl-collection

  50. Thanks! Mike Schroder @GetSource https://getsource.net Director of WordPress Strategy @

    DreamHost