What is the cache hit ratio?
The cache hit ratio is the share of requests a CDN serves from cache. Purges, short TTLs and broad cache keys or Vary headers all lower it.
The cache hit ratio is the share of requests a cache answers from storage, out of all the requests it could have cached. A higher ratio means fewer requests reach the origin and more visitors get a fast response. CDNs report it per zone or distribution, and sometimes per PoP or per URL.
hit ratio = hits / (hits + misses)
9,000 hits, 1,000 misses -> 90%What lowers it:
- A cache key or `Vary` that splits one page into many entries.
- Short TTLs, which expire entries before they are reused.
- Purges, which empty the cache all at once. Right after a deploy, the ratio for the purged pages is zero until visitors or a warmer fill them again.
- Low traffic per page per PoP. An object requested rarely in one region is often evicted before it is reused.
A site-wide average hides the post-deploy dip. Look at the hit or miss of your important pages right after a purge, which is what cache warming changes.
Related terms
References
- Amazon CloudFront: Increase the proportion of requests served from cacheshttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cache-hit-ratio.html
- Cloudflare: Default cache behaviorhttps://developers.cloudflare.com/cache/concepts/default-cache-behavior/
Warm your cache after every deploy
sitewarm requests the pages in your sitemap after a deploy and reports the cache state the CDN returns for each one, with the vantage point it was measured from.