Rate Your Experience

How to improve my cache hit rate?

Modified on: Thu, 14 Mar, 2024

What is a cache hit?


A cache 'hit' occurs when a user request for your content is fulfilled by the closest edge server rather than the origin server. In contrast, a cache 'miss' occurs when a similar request cannot be fulfilled by the closest edge server, meaning that the request has to travel all the way to the origin server and back again.


Why is this important?


Take a look at the below image. Note that the average host response time for a cache hit is just 7.52ms (milliseconds) compared to 715.12ms for a cache miss, a difference of 707.6ms. What this means is that when a user's request for this site content is fulfilled by the origin server rather than the closest edge server (a cache 'miss'), it takes nearly a second longer on average for this content to be returned to Ezoic by the host than if it were to be fulfilled by the closest edge server instead (a cache 'hit'). As you can see, this has a knock-on effect on both time to first byte and time to interactive, as well as engagement.

image


A high cache hit rate combined with Ezoic’s free site speed features will help to ensure fast speeds and good Core Web Vitals for most sites.


Okay, and the cache hit rate?


This is expressed as a percentage, and is calculated by taking the number of cache hits and dividing it by the number of cache hits and misses combined.


For instance, where Ezoic's CDN returns 95 cache hits and 5 cache misses, the cache hit rate would be 95%.


Where can I view my cache hit rate?


You are able to view your cache hit rate by navigating to the Analytics tab in your dashboard and scrolling to the Site Speed section in the left column. From there, you can select Caching > Ezoic Caching, and you'll see the cache 'hit' and 'miss' percentage data. 

image


image


You can also view the cache hit % on the home page of your Ezoic Dashboard.


How can I improve my cache hit rate?

Outlined below are some steps that can be taken to improve your cache hit rate if you're seeing a high amount of cache misses for your site.

1) View URLs that are not getting cached using BDA.


Go to your Big Data Analytics and scroll to Site Speed > Caching > Ezoic Caching. From there, you can click on 'Cache Miss' which will load a report of all the pages that are not being cached, and give reasoning as to why Ezoic is not caching that page.


image


Alternatively, you can take any URL from your site and enter it to the 'Debug Cache' tool under the 'Caching' section of the Leap app. The Debugger will either identify why the URL isn’t cached, or let you know that the page is being cached.


image


Based on your results, you can adjust the following settings:


a) Increase the cache age


When you enable caching via Ezoic, it will automatically respect whatever 'maximum cache age' headers you have set up on the origin server end. However, if there is no maximum age specified in the cache headers, we will set a default 30 day 'Default Cache Age' (2592000). This means that your pages will be stored in our CDN for 30 days before they are updated. You are able to increase the 'Default Cache Age' so that your pages are stored for longer before they are updated. If your cache hit rate is low, increasing the 'Default cache Age' to 30 days (if your Default Cache Age was previously set to less than this) could improve this. Editing the 'Default Cache Age' can be achieved by clicking “Setting Values” and amending the number of seconds under 'Default Cache Age' (we have a minimum of 3600 seconds = 1 hour that must be set).


image


* Please note that if your content is regularly updated increasing the cache age may prevent those accessing a cached version of the pages from seeing an up to date version. We recommend using Ezoic's WordPress plugin to automate clearing the Ezoic cache any time you make changes: https://support.ezoic.com/kb/article/how-can-i-set-up-the-ezoic-wordpress-plugin-for-cdn-management?id=how-can-i-set-up-the-ezoic-wordpress-plugin-for-cdn-management&lang=en-US


b) Override cache control headers


Our caching is set up to automatically respect any caching rules already set up for your site at the origin end when you integrate. However, sometimes the cache control headers set up at your server end can prevent our cache from hitting. These can include cache-control headers, vary headers and expires headers.


You are able to override these headers by navigating to the 'Caching' section within the Leap app and selecting 'Setting Values'. From there, you can edit the 'Override Cache Control Headers' from 'OFF' to 'ON'.


image


*Please note that if you have a Vary by Cookie set, this may be important to the functionality of your site. Therefore, if we override this rule, our caching will ignore any cookies that are set for the use of changing your site content. If the functionality of your site is negatively affected, you can switch this setting back to 'OFF'.


2) Remove any incompatible caching plugins


If you are integrated using the Wordpress plugin method, are seeing a high cache miss rate, it may be worth checking that you don't have any incompatible caching plugins enabled for your site that cache in front of Ezoic. Examples of typically incompatible caching plugins include:


- Swift Performance Cache
- LiteSpeed Caching
- WP Fastest Cache
- AutoOptimise/AutOptimise cache
- WP-Optimize
- SG Optimizer


More information on technology that is incompatible with our speed tools can be found here: What known caching plugins work or don't work with Ezoic?


3) Check your Cloudflare caching settings


You can use both Cloudflare caching and the Ezoic Caching app at the same time, as this will just give your site two layers of caching. If you are using your own Cloudflare account through Cloudflare integration, you will just need to make sure your Cloudflare cache settings are set to "standard" or "aggressive" so that they are compatible with Ezoic's caching app.  If the cache hit rate is significantly lower than expected, it is always worth checking that your settings in Cloudflare are set to 'standard'.


Is there anything else I should be aware of?


  • Theme settings in Wordpress may attempt to minify, async, or defer scripts, making them impossible for Ezoic to cache
  • Wordpress plugins that do “image optimization” often cache the images on their own CDN, resulting in Ezoic being unable to cache them or optimize them in any way. Often, these image optimization plugins will significantly add to overall time to interactive.
  • Speed and caching plugins that attempt to minify, cache, defer or async code elements of the site could also result in Ezoic being unable to cache the page.


More information on Ezoic's CDN and caching app can be found here.



Loading ...