I’ve tried a lot of different caching configurations on my site over the years. 3rd party plugins, server-based caching, Cloudflare caching – and I soon hope to try LiteSpeed’s new QUIC.cloud. I’ve experimented with different configurations, combining multiple techniques, and I’ve finally settled on my preferred setup – two layers of caching. One at the local server, and one somewhere on the cloud. I believe it provides the best mix of performance and flexibility for an average WordPress site.
Let me explain the two layers that I use, and why I believe my set up is the best.
1. Caching at the Origin – Either 3rd Party Plugins or Server-Based
The first layer of caching that I recommend, is at your origin server. If you’re using WordPress, this can take the form of 3rd party plugins like W3 Total Cache or WP Rocket. Or if you’re lucky enough to host with a provider like NameHero, you can use the built-in server caching of LiteSpeed. As explained in the linked article, the latter if faster than the former because it doesn’t use up server resources allocated to your website, unlike other PHP based plugins on WordPress. So you don’t suffer any performance penalty for using it.
Caching at the origin means that every page is generated exactly once.
2. Caching on the EDGE
I’ve hovered back and forth between the usefulness of caching content on the EDGE. On the one hand, it seems to run into problems with EDGE CDN providers like Cloudflare discarding your cached content if its not accessed for a couple of days. And on websites with hundreds of URLs, this means that a large chunk of your content will always remain uncached. Plus, if you make a change on your site, the entire cache needs to be purged again. Hence, I was against it.
But then I started to use it differently with only caching for a few top performing pages. The free Cloudflare plan allows you only 3 rules, so it can get rather sticky if you want to cache specific pages, but if you pull the lever for the Pro plan, you get a whopping 20 page rules to play around with. This can dramatically speed up the most important parts of your site.
Lately, I’ve started using the WP Cloudflare Super Page cache to reduce my global TTFB to less than 0.5 seconds. The plugin takes a lot of the headache out of EDGE caching, with automatic page-specific content purging, allowing us to access the admin area without breaking the page cache, or accidentally serving logged in content to anonymous users. It works great! I suggest you check it out.
Why the 2-Tiered Structure Works
The 2-tiered structure works for two different types of content. Frequently used content gets served via the high-speed page cache. Relatively little used content gets sent to the origin server, where it is served using the generated cache. The advantage of the latter is that it has no expiry date. I suppose there is a slight delay when the cached content is not found at the EDGE, and has to go to the origin, but compared to the benefits, I believe the trade-off is more than worth it.
So two caching tiers appear to be the optimal choice. Using this, I’ve managed to greenlight all my Core Web Vitals metrics in the Google Search Console. And with a little bit of experimentation, you can do the same. Stay tuned for more updates on this, as NameHero continues to push the boundaries of what’s “standard” in web hosting!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!