Cache hit ratio is the percentage of requests a cache serves directly from stored content instead of pulling from the origin server. You calculate it as cache hits divided by total requests, then multiplied by 100. A site with 9,400 hits out of 10,000 requests runs at a 94% cache hit ratio. The higher that number, the faster your pages load and the less work your origin does. This guide breaks down the formula, healthy benchmarks, what quietly drags the ratio down, and the exact levers that push it back up. Miss the wrong header, and a 95% cache can collapse to 60% overnight.

Key Takeaways

  • Cache hit ratio = cache hits ÷ total requests × 100, expressed as a percentage.
  • A ratio above 95% is the target for CDN edge caching on static-heavy sites.
  • Every cache miss forces an origin fetch, adding roughly 100 to 200 ms of latency per request.
  • Cache keys, query strings, cookies, and Vary headers are the usual reasons a ratio drops.
  • Raising the ratio from 85% to 95% can cut origin bandwidth by more than half.
  • Cache hit ratio and Time to First Byte move together: more hits, lower TTFB.

What Is Cache Hit Ratio and Why It Matters

Cache hit ratio measures how efficiently your cache answers requests on its own. When content is already stored at the edge, the cache returns it in milliseconds. When it is not, the request travels back to your origin, which costs time and compute.

Think of it like a barista who keeps the ten most-ordered drinks pre-made. If 94 of every 100 customers order from that ready shelf, service is instant. The other 6 wait for a fresh brew. Cache hit ratio is simply the size of that ready shelf, measured in percentages.

For a DevOps or cloud engineer, this metric is a direct readout of infrastructure health. A CDN reporting 96% means your origin handles only 4% of traffic. Drop to 80%, and your origin suddenly shoulders five times the load it did before, often without any change in visitor numbers.

A self-service content delivery network helps teams manage cached content closer to users, improving delivery efficiency while reducing unnecessary requests back to the origin server.

Pro Tip
Track cache hit ratio per content type, not just site-wide. Images might sit at 99% while HTML pages languish at 70%, and the blended number hides the real problem.

That gap between what most dashboards show and what is actually happening is where the interesting decisions live. Start with the math.

How to Calculate the Cache Hit Ratio

The cache hit ratio formula is cache hits divided by the total number of requests, multiplied by 100. Total requests equals cache hits plus cache misses, so you can also write it as hits ÷ (hits + misses) × 100.

How to Calculate the Cache Hit Ratio

Say your CDN logs show 9,400 hits and 600 misses over an hour. Total requests are 10,000. Divide 9,400 by 10,000 to get 0.94, then multiply by 100. Your cache hit ratio is 94%, and your cache miss rate is the remaining 6%.

Step by step

  1. Pull cache hits and cache misses from your CDN or reverse proxy logs for a fixed window.
  2. Add hits and misses together to get total requests.
  3. Divide hits by total requests.
  4. Multiply by 100 to express it as a percentage.

One detail trips people up: a request that is neither a clean hit nor a true miss, such as a revalidation or a stale response, gets counted differently across vendors. Read our breakdown of What Is a Cache Miss before you trust a raw number, because a miscounted miss can make a healthy cache look broken.

Cache Hits vs Cache Misses: What Actually Happens

A cache hit means the requested content already lives at the edge and is served immediately. A cache miss means the content is absent or expired, so the edge fetches it from the origin, stores a copy, then serves it.

The cost difference is not subtle. A cache hit from a nearby edge node typically returns in 20 to 40 ms. A miss that round-trips to an origin three regions away can take 150 to 250 ms, and that is before your application server even starts rendering.

You might be thinking that a few misses hardly matter. On a low-traffic blog, correct. On an API gateway serving 50,000 requests per minute, a 10-point drop in hit ratio means 5,000 extra origin calls every minute. That is where autoscaling bills spike and where good caching solutions earn their keep.

Pro Tip
A first request for any new asset is always a miss by design. Judge a cache by its steady-state ratio, not the cold-start numbers right after a deploy.

What Is a Good Cache Hit Rate?

A good cache hit rate depends on content type, but for a static-heavy site behind a CDN, anything above 95% is healthy, and 90% to 95% is acceptable. Below 80% usually signals a configuration problem worth investigating.

What Is a Good Cache Hit Rate?

Cache Hit Ratio Rating What It Usually Means
95% and above Excellent Static assets and most HTML served from edge
90% to 95% Good Solid caching with minor tuning left
80% to 90% Fair Query strings or short TTLs leaking traffic
Below 80% Poor Cache keys, cookies, or Vary headers misconfigured

Here is the contrarian part. Chasing 99% is not always the win it looks like. If you force a 99% ratio by caching personalized or rapidly changing content too long, you serve stale data. A news homepage cached for 24 hours shows yesterday’s headlines. The right target balances freshness against speed, which is why 95% beats 99% for most dynamic sites.

Yes, a higher number is generally better, but only when the cached content is genuinely reusable. For a deeper look at squeezing more from your delivery layer without sacrificing freshness, see CDN Boost.

How Cache Hit Ratio Affects CDN Performance

Cache hit ratio is the single biggest lever on CDN response time. More hits mean more requests answered at the edge in milliseconds, which directly lowers Time to First Byte and reduces origin bandwidth and cost.

How Cache Hit Ratio Affects CDN Performance

The relationship is close to linear on the cost side. Move from an 85% to a 95% hit ratio and origin requests fall from 15% of traffic to 5%, a two-thirds reduction. One media client we audited cut monthly origin egress by 61% with that exact shift, and their p95 TTFB dropped from 340 ms to 90 ms.

Geography matters here too. A secure CDN places cached copies close to users, so a hit in Frankfurt never has to reach an origin in Virginia. Pair that with an Anycast Network and requests route to the nearest healthy edge automatically, keeping both latency and miss penalties low.

Pro Tip
Watch TTFB and cache hit ratio on the same dashboard. When TTFB climbs while traffic is flat, a falling hit ratio is almost always the cause.

What Drags Your Cache Hit Ratio Down

Most cache hit ratio drops trace back to a handful of causes, and nearly all of them are configuration rather than traffic. The cache is working; it is being told not to store or reuse content.

The usual suspects, ranked by how often they cause real damage:

  • Query strings: ?utm_source=x and ?v=123 create a unique cache key per URL, so each variation counts as a fresh miss.
  • Cookies: Set-Cookie on cacheable responses tells many CDNs to skip caching entirely.
  • Short TTLs: A max-age of 60 seconds forces constant revalidation and re-fetching.
  • Vary headers: Vary: User-Agent multiplies cache entries across thousands of device strings.
  • Aggressive purging: Full-site flushes on every deploy reset the cache to zero hits.

Purging deserves special care. Flushing everything to update one page is like emptying your whole fridge to replace the milk. Targeted invalidation keeps the rest of your cache warm. Our guide to Cache Invalidation in a CDN covers how to purge one path without wrecking your ratio.

How to Improve Your Cache Hit Ratio

You raise cache hit ratio by caching more content, keeping it cached longer where safe, and reducing the number of distinct cache keys. The goal is fewer, more reusable cached objects that satisfy more requests.

How to Improve Your Cache Hit Ratio

The highest-impact moves, in order

  • Set correct, longer TTLs on truly static assets like CSS, JS, and images.
  • Normalize cache keys by stripping non-essential query strings and cookies.
  • Cache static assets aggressively and version filenames instead of using cache-busting query strings.
  • Replace full-site purges with targeted, path-level invalidation.
  • Limit Vary headers to values that genuinely change the response.

Offloading heavy or repeated work to the network helps too. Running logic on Edge Computing lets you cache computed responses close to users, while Image Optimization serves the same processed asset to everyone instead of generating variants that each miss the cache.

For teams focused on raw speed, a dedicated website boost layer combined with Load Balancing spreads any remaining misses across healthy origins, so the few requests that do slip through never overwhelm a single server.

Pro Tip
After each change, wait for the cache to re-warm before measuring. A ratio checked ten minutes post-deploy will understate your real improvement by a wide margin.

The Bottom Line on Cache Hit Ratio

Cache hit ratio is the clearest signal you have of how hard your infrastructure is working versus how hard it needs to. A number above 95% means your edge is doing its job, your origin stays quiet, and users get fast pages. The path to that number is rarely about buying more capacity; it is about configuration discipline around cache keys, TTLs, and purging.

Treat the ratio as a health metric you watch alongside TTFB, not a vanity score to maximize at any cost. The best result is the highest hit ratio you can hold while still serving fresh, correct content. Get that balance right, and speed, cost, and reliability all improve together.

Frequently Asked Questions About Cache Hit Ratio

What is a good cache hit ratio?

For a static-heavy site behind a CDN, above 95% is excellent and 90% to 95% is good. Below 80% usually points to a misconfiguration such as leaking query strings or cookies rather than a traffic problem.

What is the difference between cache hit rate and cache hit ratio?

They mean the same thing. Both describe the share of requests served from cache, expressed as a percentage. Cache miss rate is simply 100 minus the hit ratio.

Why is my cache hit ratio low?

The most common causes are unique query strings, Set-Cookie headers on cacheable responses, short TTLs, overly broad Vary headers, and frequent full-cache purges. Each one either prevents caching or multiplies cache keys.

Does cache hit ratio affect SEO?

Indirectly, yes. A higher ratio lowers Time to First Byte and page load time, which are inputs to Core Web Vitals and a factor Google uses in ranking. Faster pages also reduce bounce and improve engagement.