# Two Layers of Caching is Optimal – No More No Less

> The best setup is two layers of caching for your site. One on the origin server, and one running on the EDGE servers. Here's why.

- Author: [Bhagwad Park](https://www.namehero.com/blog/author/bhagwad-park/)
- Published: 2020-10-02
- Updated: 2020-10-02
- Category: [Website Performance](https://www.namehero.com/blog/category/website-performance/)
- Web page: https://www.namehero.com/blog/two-layers-of-caching-is-optimal-no-more-no-less/

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](https://www.namehero.com/blog/why-litespeed-cache-is-better-than-caching-plugins/). 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](https://www.namehero.com/blog/cache-everything-on-cloudflare-the-right-way/). 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](https://www.namehero.com/blog/is-a-cloudflare-pro-plan-worth-it/), 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](https://www.namehero.com/blog/how-to-reduce-your-ttfb-to-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.

## Bottom Line

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!

## Related posts

- [How Many Layers Of Website Caching Are Acceptable?](https://www.namehero.com/blog/how-many-layers-of-website-caching-are-acceptable/)
- [4 Caching Strategies That Will Speed Up Your Website](https://www.namehero.com/blog/4-caching-strategies-that-will-speed-up-your-website/)
- [How to Track Competitor Website Traffic in 2025](https://www.namehero.com/blog/how-to-track-competitor-website-traffic/)
