There are a few key techniques I use to get my WordPress websites to load as quickly as possible. I’ll share them here, hopefully this helps somebody out there squeeze some juice of of their websites and their web hosting.
VPS Web Hosting
It helps a lot to have a bit more of a serious hosting option that shared web hosting. Shared web hosting can be fine, and it certainly is cheap. But you will be sharing server resources with many other websites, and you never know what sloppy stuff people will be running on the server alongside your own websites, fighting for resources as people try to load your pages. Plus, with shared web hosting you can’t configure and optimize your server in the same way that you can with VPS or dedicated hosting.
I mention VPS hosting because it is a nice way to get excellent server speeds without the cost of dedicated web hosting. VPS can be affordable, I’m only paying about $40 a month to host around 45 WordPress sites on one VPS hosting account. That’s a pretty good value for me, in my situation.
And once you have a VPS hosting account, you will gain access to server optimization features that you typically won’t get from a shared web host.
With my VPS hosting account from Knownhost, for example, I have WHM/cPanel to manage server configurations and hosting accounts, and on top of that can use SSH to do pretty much anything I need to. I also can build Apache and configure PHP and many other things to my own specifications, which I couldn’t do with shared web hosting.
I’ve been using this caching option on my VPS and it works well for my needs. It can be enabled by during the Apache build process. Once it is enabled it works server-wide. From the Opcache intro:
OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.
My production configuration ended up being something like this (I still tweak values from time to time):
W3 Total Cache
Both of these work great, give them a shot.
Gzip Compression with Apache
Apache can compress your website easily for you before sending it out to the user, using the Deflate module. If you have this module enabled, you can add some code to .htaccess to compress your entire website easily.
Leverage Browser Caching
Apache can also work with the browser cache to keep your website loading quickly, using the Expires module. Like the Deflate module, if you have this enabled you can add code to .htaccess to utilize it.
It’s a good idea to optimize the MySQL configuration for your particular server setup as well. Do do so, you can use MySQL Tuner and make the suggested changes to the MySQL configuration.
Here’s a quick guide on MySQL Tuner usage.
As you can see, these are a mix of WordPress specific and server-related optimizations. If you can manage to pull off most of these, you will likely achieve excellent performance with your WordPress website. Even just implementing a couple of these optimizations can help.