This WordPress based website loads fairly quickly, or at least I’d like to think so based on my testing. In this post I’m going to share some of the things that I’ve setup in order to get the fastest possible page loads from WordPress.
We’ll be covering general server configuration, Nginx web server configuration, WordPress plugin configuration, and finally use of content distribution networks.
In my opinion this is where it all starts, having at least somewhat decent server hardware while not required will definitely help. For instance having SSD backed storage can help increase the load time of assets. While we will aim to cache as much as possible in RAM or externally on a CDN, this is still important and should be considered.
While hopefully the majority of requests to the website will be offloaded to the CDN (discussed later), placing the server geographically close to your target audience will also be beneficial for requests that do need to make their way back to the server. For example, the majority of my traffic is US based, so I’m using Amazon Web Services (AWS) with my EC2 instance running on the US east coast. This was chosen over the west coast to also have it closer to Europe, which is my second largest source of traffic.
If you’re looking for some sort of VPS for your website, I’d recommend taking a look at AWS EC2 instances. In the year that I’ve been using them I’ve found the services to be highly reliable.
Personally I make use of the Nginx web server, based on my own benchmarks I’ve found that it performs very well and has all of the features that I need. I have created my own Nginx configuration which is mostly based off of this. Nginx have already created a good sample configuration for working with the WP Super Cache plugin (discussed next) which works well.
This configuration will serve out static .html files. These static files are created by our caching plugin.
By default the Linux operating system should cache these files as they are accessed in system memory, so they should be served out fairly quickly unless you’re pressed for free memory.
WordPress has a number of caching plugins available for you to install. These aim to store normally dynamic page contents as static HTML files. This can speed up requests, as rather than having PHP scripts and database calls taking place each page load, all the web server has to do is pass a static HTML page which takes up far less server resources.
I’m using the WP Super Cache plugin, however if I was installing a new caching plugin today I’d probably go with W3 Total Cache as it appears to be more feature rich these days. Both can be configured to work well with Nginx.
Content Distribution Network
Personally I make use of Cloudflare for this purpose as it provides a number of other useful features and overall speeds up my website around the world, and all for free. I do currently pay for the pro plan at $20 USD per month, however the free plan is still extremely good. Check out my previous post on Cloudflare where I compare the free plan against the paid pro plan if you’re interested in seeing the differences.
Otherwise I’d recommend a look at CloudFront which also performs well, caching plugins such as WP Super Cache are able to be configured to work with various CDNs.
Optimizing images as much as possible is another big one. Photoshop for example can be used to optimize images so that they still look great but are compressed and take up the least amount of space as possible. Although I’m not too concerned with bandwidth costs as Cloudflare offsets a lot of that, keeping overall file size to the minimum will always help speed up load time and save you some dollars in bandwidth.
When you combine each of these different components together you can create a very fast loading website. If you haven’t previously considered any of these aspects I’d recommend taking a look to see what can be improved to help speed up your own website.