Skip to main content
Cache Hit Ratio
Updated over 5 months ago

One of the metrics in the top widget on your Dashboard is “Cache Hit Ratio”:

Cache hit ratio measures how many requests a cache has delivered successfully from its storage, compared to how many requests it receives in total.

The formula for calculating cache hit ratio is as follows:

Cache hit ratio (%) = [Cache Hits / (Cache Hits + Cache Misses)] x 100

Important note: On the Dashboard, we are displaying the Cache Hit Ratio as it follows - 3 days back for the Free subscription and 30 days back for all paid subscriptions.

What is a Cache Hit?

A “cache hit” occurs when your site’s files are requested and successfully served from the cache.

By retrieving the data from the cache, the browser can display your site’s content faster.

What is a Cache Miss?

A “cache miss” occurs when the requested content is not found in the cache memory.

As a result, the request is passed along to the origin server, which sends back the requested file.

Cache misses respond slower as the request needs to reach the origin server, which will need time to process the request and send back a response.

Important Note: Cache Hit Ratio only concerns pages that have the potential to be optimized. NitroPack doesn't count as cache misses pages that will never be optimized under any circumstances.

Benchmarks

Based on preliminary data, the global Cache Hit Ratio for NitroPack is 90%.

Roughly 70% of NitroPack’s users experience a Cache Hit Ratio of 80% or higher.

Disclaimer: It’s normal for some sites to have a Cache Hit Ratio lower than our benchmarks. If you experience a lower CHR, you can try improving it by applying some of the methods mentioned below.

What Does NitroPack Do to Guarantee a High Cache Hit Ratio

To be able to guarantee a cache hit ratio of 80% or higher, NitroPack implements several techniques:

  • Cache Invalidation marks the cached content as "stale" but keeps serving it until newly optimized content is available. As a result, your visitors always see optimized content (cache hit), even though it may be outdated for a short while.

  • Cache for logged-in users and users with items in their carts (only on the supported platforms). Serving cached content to logged-in users, including their carts, it’s usually not good practice. However, NitroPack’s caching mechanism allows that to happen without interfering or deteriorating users’ experience. Again, this feature is only available on supported platforms.

Reasons for a Low Cache Hit Ratio

The cache is still young

If you just registered your site, it is normal to see a lower cache hit ratio. The cache systems need some time to populate their cache storage. Depending on the size of your site, this can vary from a few minutes to a few hours.

Cache Warmup isn’t enabled

The two main functions of Cache Warmup are to:

  • Keep your website optimized;

  • Preemptively optimize all pages found in a configured URL source.

If enabled, Cache Warmup simulates organic visits to all pages found on the provided source (home page/sitemap XML) or any page that was purged individually or by tag, which triggers our caching mechanism and the pages are optimized/cached.

Disabling Cache Warmup means that your pages won’t be optimized preemptively. In that case, an organic visit needs to occur before our mechanism begins optimizing/caching a page, meaning that the first visit will result in a cache miss.

Тоо many dynamic content cookies

Dynamic content cookies are used to create different optimized versions of your pages for users that visit your site with some combination of cookies - for example, language + currency.

Having too many variations might lead to unoptimized page versions.

These unoptimized pages, in turn, lead to increased cache misses (served from the origin server) and a lower cache hit ratio.

However, a page with cookie variation is still optimizable and will be optimized after few organic visits occur

Frequent Cache Purges

Frequent cache purges reduce the probability of the end-user hitting an optimized page.

One of the reasons for frequent purges may be too many tags set on each page.

For instance, If a page is linked to 10 other pages and the cache of that page is purged, this purge will cause the other 10 pages also to get a new optimization (because of invalidation).

As a result, your homepage will be in a “Pending” optimization status all the time since it is constantly marked as stale due to purges of internal pages.

There are different ways to reduce cache purges like:

  • Limiting the frequency of article updates to a specific time window during the day. If you frequently update a piece of content, then it may not be possible for optimizations to catch up.

  • Checking the number of NitroPack cache tags referenced on each page. Reducing the number of linked objects might help lower the number of cached pages that are purged (and re-optimized) via tags.

Before applying different optimization techniques, you could inspect your service usage log to understand the cause of the issue better.

UTM Parameters

Running multiple ad campaigns (e.g., Facebook ads, Google ads, etc.) generates different URLs with specific UTM parameters.

As a result, you have a single page with multiple variations (different UTM parameters) that need to be optimized.

To improve your cache hit ratio and keep your cache as lean as possible, you can simply enable the “Include the default ignored parameters” option:


NitroPack ignores some commonly used parameters by default, so that will do the work for you.

In case that the specific UTM parameter you need to be ignored is missing from the list, you can specify it in the field above:

Did this answer your question?