Caching the pages of your website is important because it ensures your users are getting the most-updated version of your pages while also not updating them so often that it loads slowly. Finding the balance between the two for the various pages of your website can be the difference between someone reading your content and bouncing!
For example, let’s assume the average response time for a cache hit is 7.52 milliseconds (ms), while a cache miss is 715.12 ms. While 707.6 ms doesn’t seem like much, when you consider how long the average user will wait for a page to load (3 seconds), every millisecond counts. This has an effect on both time to first byte, time to interactive, and engagement.
Don’t know what a cache hit rate is? Aren’t sure how to improve it? Keep reading!
What is a cache hit, cache miss, and cache hit rate?
First, what is a cache hit? A cache hit is when a user requests a file and the request is fulfilled by the nearest edge server of a CDN. On the flipside, a cache miss is when the CDN does not obtain the requested content. If a CDN cannot fulfill the request, it is sent along to the origin server for the information.
So then, what is a cache hit rate? Cache hit rate is how many requests a cache is able to fulfill versus how many requests it receives. The formula for calculating cache hit rate is
The cache hit ratio is often presented as a percentage, so you would simply multiply the cache hit ratio by 100 to get the percentage. For example, if a CDN has 20 cache hits and 5 cache misses, then the formula would look like the following:
A good cache hit rate for a mostly-static site is around 95-99%; if you have a lot of content that gets updated frequently, you may have a lower cache hit rate, though that’s not always the case.
Where can I see my caching rate?
In Ezoic’s Big Data Analytics, publishers can view their cache hit/miss rate. To find it, navigate to Site Speed > Caching > Ezoic Caching.
Here, you will find Cache Hit, Cache Miss, and Cache Off. Cache off means there are other caching rules set through a host or how a publisher has their cache control headers set inside the caching app. Learn how to set your cache control headers below.
How do I improve my cache hit rate?
There are three things you can try if your cache hit rate is low and you want to improve it.
1. View URLs that are not being cached
- Using Big Data Analytics, you can easily see what URLs are not being cached; ensuring they are being cached will improve your hit rate.
- To see which URLs are not caching in Big Data Analytics, navigate to Site Speed > Caching > Ezoic Caching. At the bottom, where it shows Cache Hit, Cache Miss, and Cache Off, click Cache Miss. This will load a report of pages that are currently not being ached on your website.
Additionally, Ezoic has a Cache Debugger tool in the Site Speed tab of Ezoic publisher’s dash board. At the top, select Caching. Scrolling down, you will see ‘Debug Cache.’ Here, you can enter in a URL to check if it is being cached.
If you find that your site or particular URLs aren’t caching, you can do one of two things.
Increase the cache age
If you’re using the caching app, it will automatically follow the maximum cache age headers you have set with the origin server. If there isn’t a maximum age set, Ezoic’s CDN will store your pages and will automatically cache your pages every 30 days.
Increasing the cache age means extending this time period past 30 days. This may increase your cache hit rate since our CDN will have to call to the origin server less.
If you want to increase the cache age, navigate to the Caching App and scroll down to ‘Default Cache Age,’ where the minimum is 3,600 (1 hour).
If you regularly update content, increasing the cache age may prevent those pages from displaying an up-to-date version. If you use Ezoic’s WordPress plugin, you can automatically clear the Ezoic cache any time you make a change.
Clear cache control headers
Since the Ezoic caching app automatically respects whatever cache settings you already have for your site when you integrate, it may conflict with whatever caching you initially have in place. This includes cache-control headers, vary headers, and expires headers.
To override these cache settings, go to the Caching App and find find ‘Override Cache Control Headers.’ After selecting edit, change the settings to ‘ON.’
It’s important to note that if you have a ‘Vary by Cookie’ set and you choose to turn on Override Cache Control Headers, Ezoic will override the cookie rule, potentially affecting the functionality of your site. If this is the case, you can switch this setting back to ‘OFF.’
2. Remove any incompatible caching plugins
If you have a low cache hit rate, it could be because you have other caching or site speed plugins. The plugin could be attempting to cache at the same time Ezoic’s caching is attempting, which will cause caching issues.
We have a helpful list of Ezoic-compatible software and plugins here: https://www.ezoic.com/certified-seamless-with-ezoic/
3. Review your Cloudflare caching settings
You can use Cloudflare caching and Ezoic caching at the same time. If you are using your own Cloudflare account and are Cloudflare integrated, you just need to ensure your Cloudflare cache settings are ‘Standard’ or ‘Aggressive’ so they are compatible with Ezoic’s caching.
4. Check your WordPress theme and plugins
Lastly, you will want to review your WordPress, as there are a few things that can inhibit Ezoic caching.
WordPress theme settings
It’s possible your WordPress theme may have settings that attempt to minify, async, or defer scripts. This will make it impossible for Ezoic to cache.
It’s also possible that WordPress plugins that perform image optimization, speed, or caching can interfere with Ezoic caching. Turning off or deleting these plugins and using solely Ezoic caching and site speed—which has all of the same features and more as these WordPress plugins—can increase the cache hit rate.
Checking your site’s cache hit rate is easy and important to the overall functionality and success of your website. If the cache hit rate is too low, it means your website is loading slower, as it has to call to the origin server. Modifying your caching rules is an easy way to ensure this rate increases and stays high, so users are receiving updated webpages only when it’s necessary.
Check your cache hit rate in Big Data Analytics now!