Tried & Tested — The best stack for WordPress speed on a VPS

ben

Well-known member
Joined
Jul 8, 2024
Posts
454
Reaction score
328
Trophy points
64
I've spent many years using WordPress. People will argue that it isn't a suitable platform for design, but if that's the case, why do lots of mega corps use WordPress for their websites? Over the last couple of years, I've been fortunate enough to have the time and money to waste finding the fastest setup for WordPress, and it goes a little something like this:

Hardware​


You're going to want to have a decent size VPS. Now, WordPress can run on 1GB of RAM quite easily, but it doesn't mean it should be running on a server with only 1GB of RAM. Once you calculate in resources and whatnot, and you've developed your website, you're going to want to have a nice chunk available. You also want to choose a provider where you can scale vertically if your platform takes off, and you suddenly find yourself with more concurrent connections than you I/O can handle. That's why I always choose Cloudways, with a minimum of 2GB RAM. Cloudways recommends 4GB for production, but you really don't need that much unless you are expecting large traffic right away. Cloudways also have an auto-scale feature, which is handy if you have traffic suddenly, and don't have time to scale manually, it can do it for you based on resource usage, you can read more about their "Autonomous" features, here. Their panel is also really good, easy to navigate etc.

Screenshot 2024-09-18 at 10.05.37.png

Some other good providers that can vertical scale are Katapult, by Krystal, which I highly recommend. You can also get £100 free credit if you sign up for the first time. 100% green infrastructure built and owned in the UK, of course, you can co-locate too.

Server OS​

Lots of people generally have a preference to the OS, but if you install AlmaLinux OS, Rocky Linux™, or CentOS, and then choose later on down the line that you want to install more than one instance of WordPress on the server and manage it with a panel, like cPanel, you can also install CloudLinux which is recommended. If you are reading this and you are already running WHM/cPanel, and have CloudLinux already, you're in a great position to go forward.

Web Server & Caching​

This is where the arguments begin. Lots of people over the years told me that NGINX was the thing to use with WordPress, alongside Apache as the web server. In my experience, this isn't true if you have a dynamic website (which on WordPress, is more often the case than not). NGINX is great at serving static content. If you have a WordPress site that you don't update at all (or often), you could potentially be OK with NGINX and Apache. However, with sites with dynamic content and updates frequently, I have found that LiteSpeed Web Server is the best that you can get. It's practically built with WordPress performance in mind. Some of the features you can expect that are WordPress oriented are:

  • LSCache Plugin: Native LiteSpeed caching plugin for WordPress, offering page, object, and browser caching with advanced controls.
  • QUIC & HTTP/3 Support: Built-in support for the latest web protocols, reducing latency and improving performance.
  • HTTP/2 & HTTP/2 Push: Speeds up content delivery and reduces page load times with faster connections.
  • Edge Side Includes (ESI): Allows caching of dynamic content selectively, improving cache efficiency for logged-in users or shopping cart pages.
  • Built-in Brotli Compression: Reduces file sizes for faster delivery of web assets.
  • Image Optimisation: Automatic image compression and conversion to modern formats like WebP.
  • CSS/JS Magnification: Reduces the size of static files for faster page loads.
  • Automatic Database Optimisation: Regular database cleanup and optimisation for better performance.
  • SSL Support with Auto-Renew: Easy configuration of HTTPS with built-in support for Let's Encrypt.
  • Apache Compatibility: Fully compatible with Apache's .htaccess and mod_rewrite rules, easing migration.
  • Advanced Caching: Includes object cache, browser cache, and more for enhanced speed and reduced server load.
  • PHP Process Manager: Efficient handling of PHP processes to reduce overhead and improve dynamic content performance.
  • ReCAPTCHA Integration: Built-in protection against spam and brute force attacks for logins, comments, and other forms.
  • Heartbeat Control: Limits WordPress Heartbeat API calls to reduce resource usage.
  • DDoS Protection: Built-in protection against DDoS attacks through connection, bandwidth, and request limits.
The LSCache plugin is absolutely mind blowing and very simple to use. If you are on their enterprise plan, you also get about 10k credits to use with QUIC every month, and that includes the ability to use their CDN (recommended). If you are on Cloudways, you can also use their default caching plugin "Breeze" which is developed by Cloudways, and is great. You can see an example of this on Tales from the Trees.

LSMCD​

LiteSpeed Web Server also gives you the additional advantage of being able to run their proprietary memcached port, LSMCD, which is designed as an even faster, more robust and integrated version of memcached object caching, for LiteSpeed. It's designed to be a drop-in replacement for the standard memcached. The benefit of LSMCD is that it is multi-threaded, and supports replication of data across nodes by default, something which standard memcached lacks.

  • Compatibility: Fully compatible with Memcached clients and APIs, allowing users to switch from Memcached without code modifications.
  • High Performance: LSMCD is optimised for LiteSpeed Web Server, providing faster object caching with reduced overhead.
  • Distributed Caching: Supports distributed caching, allowing multiple servers to share a single cache pool, improving scalability for high-traffic websites.
  • Replication: Offers optional data replication across multiple nodes, ensuring fault tolerance and data redundancy.
  • Multi-threading: Takes advantage of multi-threaded architecture, which provides better concurrency and performance under high traffic loads.
  • Efficient Memory Use: LSMCD efficiently uses memory to store cached objects, reducing memory wastage compared to traditional Memcached.
  • Integration with LSCache: Seamless integration with LiteSpeed's LSCache for even greater performance optimisation, especially for WordPress and other CMS platforms.

Cloudflare​

Go one step further and manage DNS with Cloudflare. At this stage, I don't recommend anything other than their free plan, but if you are getting a lot of traffic through your platform you would be wise to take on their pro plan, at the very least. The free plan is more than enough for small sites, and gives you plenty of features and security protections as standard including additional DDoS protection. You can also take a look at their WordPress specific offerings, which provide WordPress dedicated protections here.

That's the basic underlying principles of any WordPress website I spin up, if you do all of this, you will find yourself in a great position when it comes to speed and security, and you don't have to break the bank to get there.

Disclaimer: Bullet lists generated with ChatGPT for ease.
 
Ploi.io and Hetzner have been my go-to setups. Ploi makes deploying and managing the server. Hetzner reliable and cheap.
 
I host thousands of sites with LSWS, AlmaLinux, Bunny CDN, and a Hetzner server.

I think my latest server has 32CPU (AMD), 64 cores, 128gb of ram, 10TB of NVME storage. I think the monthly bandwidth on this is like 20TB of data, which isn't bad considering it never goes above one load average.

Digital Ocean is great to get things going and started, but once you start scaling up the costs are far too much. I have a few servers with them because I can't be bothered to update CF DNS records of hundreds of sites spread across multiple accounts - wish I setup the API from the beginning.
 
I host thousands of sites with LSWS, AlmaLinux, Bunny CDN, and a Hetzner server.

I think my latest server has 32CPU (AMD), 64 cores, 128gb of ram, 10TB of NVME storage. I think the monthly bandwidth on this is like 20TB of data, which isn't bad considering it never goes above one load average.

Digital Ocean is great to get things going and started, but once you start scaling up the costs are far too much. I have a few servers with them because I can't be bothered to update CF DNS records of hundreds of sites spread across multiple accounts - wish I setup the API from the beginning.
I tried Bunny CDN once, I really liked it. The only thing that took me away from it was QUIC CDN integration within the LSCache plugin, which seemed like a no brainer.

Yeah I agree that if you are running some sort of hosting stuff, you should be integrating with a provider like Google or AWS and going through their API.
 
I tried Bunny CDN once, I really liked it. The only thing that took me away from it was QUIC CDN integration within the LSCache plugin, which seemed like a no brainer.

Yeah I agree that if you are running some sort of hosting stuff, you should be integrating with a provider like Google or AWS and going through their API.
I thought the quic CDN was good, but time consuming to setup, Bunny CDN does a lot of the hard lifting for you - I mostly use it for storing media now however, like images and videos that can be static, and then use a method similar to a reverse proxy to make it seem like it is stored locally on my sites.

My biggest issue with Litespeed is mostly their WP plugin also... in the last 5 months they've had 3 exploits with it, two gave admin access with a simple request on the API... madness. But it massively improves your speed.

If you are thinking about upgrading server, using the trial of LSWS is always worth a try.
 
Back
Top