Measuring your CDN hit ratio honestly
A 95 percent hit ratio can hide a site where every page view still waits on the origin.
The headline number
Every CDN dashboard shows a cache hit ratio: the share of requests served from cache rather than fetched from the origin. It is a satisfying number to watch climb. It is also easy to misread.
Requests versus bytes versus pages
A hit ratio measured by request count is dominated by small static assets: icons, scripts, stylesheets, fonts. These are fingerprinted, cached for a year, and nearly always hits. A site can show a 95 percent request hit ratio while every single HTML page, the thing visitors actually wait for first, is a miss.
Look at hit ratio broken down by content type, and especially at HTML and API responses on their own. Those numbers usually tell a very different story.
What counts as a hit
CDNs report several cache states, and the names vary by provider:
- Hit: served entirely from the edge cache.
- Miss: not in cache, fetched from the origin.
- Stale: served from cache past its freshness while a refresh happens in the background.
- Revalidated: the edge asked the origin whether its copy was still valid, and the origin said yes.
- Bypass or dynamic: never eligible for caching.
A revalidated response still costs a round trip to the origin, even though it may be reported alongside hits. Bypassed responses are often excluded from the ratio entirely, which can make it look better than the visitor experience warrants.
Measure from the response
The most reliable source is the cache status header on real responses. Request a page several times from the same location and record the status and the time to first byte for each. A page that reports a miss every time, or that never gets faster on repeat requests, is not being cached, whatever the dashboard says.
Segment by location
A hit ratio averaged across the world hides regional differences. A location with little traffic may rarely have a warm cache, so visitors there see mostly misses. Shielding and longer lifetimes help, but first you need to see the problem.
Design for misses
Some responses should never be cached: personalized pages, checkouts, anything that must be correct to the second. For those, the goal is not a higher hit ratio but a fast origin and a fast path to it. Make sure the data those pages read is itself cached close to where the rendering happens.
The question that matters
The point of a CDN is not a high number on a dashboard. It is that visitors get fast responses. Measure time to first byte for HTML from multiple regions, and treat the hit ratio as one explanation for that number rather than as the goal itself.