CDN cache hit ratio: the number that drives your CDN bill
A CDN's cost hinges on cache hit ratio: cache hits serve from the edge cheaply, while misses hit your origin, incurring origin egress and compute. Raising the hit ratio cuts both CDN and origin cost. Here is how.
Quick answer
A CDN's cost hinges on cache hit ratio, the fraction of requests served from the edge cache versus forwarded to your origin. Cache hits are cheap (edge delivery); cache misses hit your origin, incurring origin egress and compute plus slower responses. Raising the hit ratio, via longer cache TTLs, cache-friendly headers, normalizing cache keys, and caching more content types, cuts both CDN cost and origin load. A high hit ratio is the single most important CDN cost and performance lever.
A content delivery network caches content at edge locations near users, and the single number that most determines its cost is the cache hit ratio: how often requests are served from the edge cache (cheap, fast) versus forwarded to your origin (origin egress, compute, slow). Raising it cuts cost on both the CDN and your origin.
Hits vs misses
| Cache hit | Cache miss | |
|---|---|---|
| Served from | Edge cache | Origin (fetched, then cached) |
| Cost | Cheap edge delivery | Origin egress + compute |
| Latency | Low (near user) | Higher (round trip to origin) |
A cache hit serves the content from the edge, cheap and fast, without touching your origin. A cache miss forwards the request to your origin, incurring origin egress and compute to generate the response, then caches it. So a low hit ratio means most requests hit your origin, defeating much of the CDN's cost benefit; a high hit ratio means the CDN absorbs most traffic cheaply.
Raising the hit ratio
Set longer cache TTLs where content allows (content cached longer is served from edge more), send cache-friendly headers (avoid needlessly marking content uncacheable), normalize cache keys (do not fragment the cache by ignoring irrelevant query parameters or headers that create many cache variants of the same content), cache more content types (not just static assets but cacheable API responses and pages), and use cache warming for predictable content. Each raises the fraction served from edge.
Controlling CDN cost via hit ratio
Maximize cache hit ratio: longer TTLs where safe, cache-friendly headers, normalized cache keys to avoid fragmentation, caching more content types, and warming caches for predictable spikes. Because hits are cheap and misses cost origin egress and compute, a high hit ratio cuts both the CDN bill and origin load while improving latency. It is the most important CDN cost lever, and it makes the CDN the biggest egress saving for content-heavy sites.
FAQ
Why does cache hit ratio drive CDN cost?
Because cache hits serve content from the edge cheaply and fast, while cache misses forward requests to your origin, incurring origin egress and compute plus slower responses. A low hit ratio means most requests hit your origin (defeating much of the CDN's benefit); a high hit ratio means the CDN absorbs most traffic cheaply. So the hit ratio determines how much cost the CDN actually saves.
How do I improve CDN cache hit ratio?
Set longer cache TTLs where content allows, send cache-friendly headers (avoid needlessly marking content uncacheable), normalize cache keys (ignore irrelevant query parameters or headers that fragment the cache into many variants), cache more content types (cacheable API responses and pages, not just static assets), and warm caches for predictable content. Each raises the fraction served from the edge.
What happens on a CDN cache miss?
The request is forwarded to your origin, which incurs origin egress (data leaving your cloud to the CDN) and compute to generate the response, then the CDN caches the result for future requests. So a cache miss costs origin egress plus compute and is slower than a hit. Frequent misses (a low hit ratio) mean the CDN passes most traffic and cost through to your origin.
Does cache key fragmentation hurt CDN cost?
Yes. If cache keys include irrelevant query parameters, headers, or cookies, the CDN stores many separate cache variants of what is really the same content, so each variant must be fetched from origin separately, lowering the effective hit ratio. Normalizing cache keys to ignore irrelevant variation consolidates these into fewer cache entries, raising the hit ratio and cutting origin fetches.
Can I cache more than static assets on a CDN?
Yes, and it raises the hit ratio. Beyond static assets (images, CSS, JS), many API responses and rendered pages are cacheable for some period, and caching them at the edge offloads those requests from your origin too. Caching more content types (with appropriate TTLs and invalidation) increases the fraction served from edge, cutting origin load and cost.
Does C3X estimate CDN cost?
C3X prices the CDN and origin infrastructure from your Terraform, so the base cost appears before deploy. The effective cost depends heavily on cache hit ratio, which is a usage characteristic you model, since a higher hit ratio shifts traffic from costly origin fetches to cheap edge delivery.
What to do next
Price your CDN and origin before you deploy. C3X reads your Terraform and prices your resources against a live catalog. Start with the quickstart.
Share this post
Try C3X on your own Terraform
Free and open source. No API key required. One command to install, one command to estimate.