Fastest WordPress stack

June 2, 2017 188 views
WordPress

What is the fastest WordPress stack?

Is it NGINX + Varnish + Memcached + MariaDB + PHP7 + Redis + PHP-FPM? Any tutorials for this setup?

2 Answers

Hi @nickreiner

There's no exact rule, since it depends on how your WordPress is configured - meaning, the plugins and theme.

If you're using Nginx, then PHP-FPM is a given, but you should run PHP 7.1 for speed.
MemcacheD and Redis shares a lot of same functionality, so you should only run one of them.
MariaDB 10.2 is a good choice - better than MySQL.
Varnish is awesome, but very advanced, so it might be easier to setup Nginx and use some cache plugin in WordPress to leverage almost the same speed.
And of course, use HTTP/2 over HTTPS to get faster delivery to visitors.

But more importantly, every service needs to be configured correctly and tuned to deliver maximum performance.

One of the forum users @jtittle has created a very good configuration (including installers). Have a look at the Github repo:
https://github.com/serveradminsh/installers

@nickreiner

As @hansen mentioned, there's really not an exact rule or formula, and much of what you set up will be dependent on what you need.

As a general rule of thumb, don't install every piece of software on a single server. I've seen far too many do that and the end result isn't a good one. You'll end up throwing hardware at the issue, and that's only viable for the short term -- long term, it'll be a mess.

What I normally recommend, and this, of course, depends on your needs, is to separate as much of the software as possible. By that, I mean one server runs the web server (NGINX) and PHP-FPM, one server will run the database (MySQL/MariaDB), one server will be for caching (Redis)

...

As a general note, I recommend Redis over Memcached (with a d) as it's not finicky about what you store to the cache. There's an excellent, simple to use WordPress plugin that can be used to connect and from there, it's pretty much hands-free.

https://wordpress.org/plugins/redis-cache/

...

That being said, keep in mind that the stack is only part of the equation. While you will need to tweak and tune NGINX, MariaDB, and PHP-FPM for performance, WordPress, WordPress Plugins, and your theme(s) come in to play as well.

You could easily have one of the most well-tuned stacks, but far too many plugins, a poorly coded theme, zero asset minification, large images, etc and that well-tuned stack will mean nothing as the site will still crawl.

Performance is as much front-end as it is back-end.

...

I've seen servers deployed with 4 physical CPU's (upwards of 40+ CPU Cores), 128-256GB of RAM (or more), and a RAID-10 SSD array with 10-20 disks crumble because they failed to see that performance wasn't just about having free resources.

At the same time, I've worked with clients that have deployed monster droplets -- i.e. multiple 32GB RAM / 12 CPU for web, database, etc, only to see me reduce that down to a single 16GB / 8 CPU for the web server, an 8GB / 4 CPU for the database server, and a 4GB / 2 CPU for the caching server.

The cost for 3x 32GB Droplet's is $960 a month, with what I converted that to, the cost was far less at $280. That's all due to working with them on the front and back-end to make sure they were set up as they really needed to be.

...

As far as my auto-installers (thanks for the mention @hansen !), they can be used to simplify much of what you'd need to do on your own.

The NGINX auto-installer is the most complete and comes with tuned configuration. The others, for now, are very basic and simply install software. I'd definitely recommend checking out the NGINX AI as it'll leave you with a working, tuned NGINX installation (which is compiled from source).

I am working on a newer, more up to date release, with documentation, though I'll soon be joining DigitalOcean and their Platform Support Specialist team, so much of my time has been spent interviewing and preparing on that front :-). Definitely an exciting time, but that doesn't mean that I won't be working on the installers.

If you have any other questions, please feel free to ask. I've worked with WordPress sites with low traffic as well as sites that receive upwards of 5-20 million visitors a month.

Have another answer? Share your knowledge.