chevron_right
chevron_right
How to improve my cache hit rate?
How-To/Instructional

How to improve my cache hit rate?

Last Updated a few days ago
Article Navigation
Introduction
Steps
Video
Additional Issues to Be Aware Of
FAQs
Need Further Assistance?

Introduction

Improving your cache hit rate is crucial for enhancing the speed and performance of your website. A high cache hit rate ensures that user requests are quickly fulfilled by the closest edge server, significantly reducing load times compared to requests served by the origin server. This article will guide you through understanding what a cache hit rate is, why it is important, and how you can monitor and improve your cache hit rate using Ezoic's tools. By following the steps outlined, you can optimize your site’s speed and user experience effectively.

Steps

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

  • Navigate to Ezoic's Analytics.
  • Scroll to Site Speed > Ezoic Caching.
  • Click on 'Cache Miss' to load a report of all the pages not being cached and reasons for not caching.

  • Alternatively, go to Settings > Caching > and scroll down to the Debug Cache tool to check any URL from your site. The Debugger will identify why the URL isn’t cached or confirm if the page is being cached. It will also show a list of the URLs on your site that have returned the most cache misses.

2. Increase the cache age:

  • Ezoic's caching respects the 'maximum cache age' headers that are set on the origin server. If no maximum age is specified in the headers, Ezoic sets a 'Default Cache Age' of 30 days (2592000 seconds). This means that your pages will be stored in our CDN for 30 days before they are updated.
  • To increase the 'Default Cache Age', navigate to Settings > Caching > Advanced Settings and edit the number of seconds for 'Default Cache Age'. The minimum Default Cache Age is 1 hour (3600 seconds).

  • Note: If your site's content is regularly updated, increasing the cache age may prevent users who are accessing a cached version of the pages from seeing the latest version. We recommend using Ezoic's WordPress plugin to automate clearing the Ezoic cache when changes are made: https://support.ezoic.com/kb/article/how-can-i-set-up-the-ezoic-wordpress-plugin-for-cdn-management

3. Override cache control headers:

  • Ezoic's caching respects existing caching rules set at the origin. However, cache control headers, vary headers, and expires headers can sometimes prevent our cache from hitting.
  • To override these headers, navigate to Settings > Caching > Advanced Settings and then edit 'Override Cache Control Headers' from 'OFF' to 'ON'.

  • Note: If you have a Vary: Cookie header set that is important to the functionality of your site, turning on Override may affect site functionality. If the functionality of your site is negatively affected, you can switch this setting back to 'OFF'.

4. Check for the presence of cookies

  • By default, cookies prevent caching. There's a good reason for this - many websites set cookies for logged-in users, carts, sessions, personalization, or tracking. Since a cookie can indicate that the page output should be different for each user, caching platforms (including Ezoic, Cloudflare, CDNs) normally don’t cache responses with cookies — to avoid serving personalized or dynamic content to the wrong visitor.
  • However, responses with cookies that can be cached are also impacted by this default behaviour. So if your site makes use of analytics or A/B test cookies, it's a good idea to enable caching for cookies to allow Ezoic to cache these pages.

5. Check for unnecessary Vary headers

  • The Vary header tells caching systems which request headers they must consider when deciding whether to serve a cached response or fetch a new one from origin.
  • While necessary in some cases, Vary headers make it less likely that the next visitor matches an existing cached version.
  • Removing unnecessary Vary headers therefore allows Ezoic to store just one (or a few) copies of a page rather than dozens (or even thousands) of cache variations.

6. Remove any incompatible caching plugins:

  • Some caching plugins can interfere with Ezoic because they cache in front of our system, preventing Ezoic's features from functioning on your site.
    • Incompatible plugins: Swift Performance Cache, LiteSpeed Caching, WP Fastest Cache, Autoptimize, WP-Optimize, SG Optimizer.

7. If using Cloudflare:

  • Set Cloudflare caching to "Standard" to avoid interference with Ezoic caching
  • Ensure there are no page-level rules at Cloudflare that override this.

8. Check for excluded pages:

Video

 

Additional Issues to Be Aware Of

  • Some WordPress theme settings that minify, async, or defer scripts may prevent Ezoic from caching if they inject cookies, dynamic query strings, or header modifications along with those optimizations
  • WordPress plugins that do image optimization often cache images on their own CDN, which may hinder Ezoic's caching and optimization capabilities. They may add significant time to loading speeds

FAQs

1. 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.

2. Why is this important?

Take a look at the image below. 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 affects both time to first byte and time to interactive, as well as engagement.

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.

3. What is 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, when Ezoic's CDN returns 95 cache hits and 5 cache misses, the cache hit rate would be 95%.

4. 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. You can also view the cache hit % on the home page of your Ezoic Dashboard.

Need Further Assistance?

If you need further assistance with your cache 'hit' rate, please log in via https://support.ezoic.com/ to make use of our dedicated resources for support. We're here to help!

 

× Enlarged Image

Loading ...