Cache Hit Ratio (CHR)
The percentage of requests served from cache versus total requests. A CHR of 95% means 95 out of 100 requests never touch your origin. The single most important CDN performance metric.
Full Explanation
Cache hit ratio tells you how well your CDN is doing its job. A CHR of 90%+ is good for most sites. 95%+ is great. Below 80% and you should investigate—you're probably paying for CDN bandwidth while still hammering your origin.
Common CHR killers: too many query string variations (each unique URL is a separate cache entry), Vary header on high-cardinality headers (like User-Agent), short TTLs forcing constant revalidation, or simply not setting Cache-Control headers at all.
You can measure CHR by requests (how many requests hit cache) or by bytes (how much bandwidth was served from cache). Bytes-based CHR is often lower because cache misses tend to be larger objects like video segments.
See the interactive Cache Hit vs Miss animation in the course to visualize the speed difference, and the Cache Fundamentals animation for the underlying concepts.
Interactive Animation
Examples
# Check cache status in response headers
$ curl -sI https://cdn.example.com/style.css | grep -i 'x-cache\|cf-cache'
X-Cache: HIT
CF-Cache-Status: HIT
# Calculate CHR from CDN logs
# hits / (hits + misses) * 100
$ cat access.log | awk '{print $NF}' | sort | uniq -c
95234 HIT
4766 MISS
# CHR = 95234 / 100000 = 95.2%
# Varnish: built-in stats
$ varnishstat -1 | grep cache_hit
cache_hit 95234 47.2 Cache hits
Frequently Asked Questions
The percentage of requests served from cache versus total requests. A CHR of 95% means 95 out of 100 requests never touch your origin. The single most important CDN performance metric.
# Check cache status in response headers
$ curl -sI https://cdn.example.com/style.css | grep -i 'x-cache\|cf-cache'
X-Cache: HIT
CF-Cache-Status: HIT
# Calculate CHR from CDN logs
# hits / (hits + misses) * 100
$ cat access.log | awk '{print $NF}' | sort | uniq -c
95234 HIT
4766 MISS
# CHR = 95234 / 100000 = 95.2%
# Varnish: built-in stats
$ varnishstat -1 | grep cache_hit
cache_hit 95234 47.2 Cache hits
Related CDN concepts include:
- Cache Fill — The process of populating a cache tier with content from upstream (shield or origin). A …
- Cache Key — A unique identifier generated from request attributes that determines whether requests can share a cached …
- Cache Miss Types — Cold miss: First ever request (unavoidable). Capacity miss: Evicted due to full cache. Invalidation miss: …
- Origin Shield — A mid-tier cache layer that sits between edge servers and the origin. Aggregates cache misses …
- Vary Header — A response header that tells caches which request headers should be included in the cache …