Cache Hit Ratio Calculator
A cache that hits 98% of the time feels instant; one that hits 60% barely helps at all. This calculator turns your raw hit and miss counts into a hit ratio, a miss rate, and a total request count β the numbers that show whether a cache layer is actually pulling weight.
Results
Enter data and click Calculate.
What cache hit ratio measures
Cache hit ratio is the share of requests served from cache without falling through to a slower origin (database, disk, API, or CDN origin). A hit means the response came from cache; a miss means data had to be fetched or recomputed. Always measure it over a defined time window β the last hour, day, or the period between deploys.
Why hits and misses must share the same window
The ratio only makes sense when both counts come from the same period and the same cache layer. Hits from a day and misses from an hour produce a false picture. Likewise: mixing CDN edge metrics with Redis, or summing several clusters without a clear definition of βrequest.β
- Use the same time label in Prometheus / your CDN dashboard.
- After a cache restart (cold start), hit ratio drops temporarily β that is not necessarily a config regression.
- Compare like with like: same endpoint, region, and content type.
Offload, latency, and origin cost
Every miss adds latency and origin load. At 90% hit ratio the backend still handles 10% of traffic; at 99%, only 1%. Moving from 90% to 99% is therefore a 10Γ cut in origin calls β not βjust 9 percentage points.β
- Offload β fewer origin requests means less CPU, I/O, and egress spend.
- Latency β a memory/edge hit is usually orders of magnitude faster than a miss.
- Cost β with a paid origin (API, managed DB), every miss-rate point has a real price.
TTL, capacity, eviction, and keys
- TTL β a longer TTL usually raises hit ratio but increases stale-data risk; a shorter TTL keeps data fresher at the cost of more misses.
- Capacity β a cache that is too small evicts hot keys before they can be reused.
- Eviction (LRU/LFU) β a bad policy or a storm of unique keys can tank hit ratio even with a βlargeβ RAM limit.
- Key design β overly specific keys (e.g. unused query params) fragment traffic and kill shared hits.
Layers: CDN, app, database, browser
- CDN / edge β often targets 95β99%+ for static assets; high hit ratio means less origin traffic.
- Application cache (Redis, Memcached) β typically 70β90% for dynamic data.
- DB query cache β helps repeated reads; it does not replace indexes.
- Browser cache β local to the user; invisible in server-side metrics.
Examples
- 900 hits, 100 misses β hit ratio 90%, miss rate 10%, 1,000 requests. The backend still serves every 10th request.
- Low 40% ratio (400 hits, 600 misses) β common causes: undersized cache, TTL too short, keys with session-id / unused params, cold start after deploy.
- Before / after: 600/400 (60%) β after longer TTL and cleaner keys 950/50 (95%). Origin load falls from 40% to 5% of traffic.
FAQ β cache hit ratio
- What is a good cache hit ratio for a CDN?
- For static assets (CSS, JS, images, video) a typical target is 95β99%+. HTML or personalized responses are often lower β measure separately per content type.
- Why do my hits and misses look inconsistent?
- Most often they come from different time windows, different layers (CDN vs Redis), or different request definitions. Always take both counts from the same source and period.
- Does a higher TTL always improve hit ratio?
- Usually yes, but it is not always worth it: a longer TTL raises stale-data risk. For frequently changing data, a shorter TTL plus warming of key entries can be better.
- Can a very large cache be worse?
- Yes β a huge cache with chaotic keys spends more time on management and eviction while hit ratio stays low. Fix keys and TTL first, then grow capacity.
- What is a βgoodβ hit ratio for an application cache?
- For dynamic data, 70β85% can already be solid; 90%+ is excellent, but it depends on data churn and traffic shape.
- Why does hit ratio drop after restarting Redis / Memcached?
- An in-memory cache is cold after restart β warm it or wait for traffic to refill it. That is normal, not necessarily a config bug.
- Does this calculator show a trend over time?
- No β it computes a one-shot ratio from the numbers you enter. Trends need monitoring (Prometheus, Grafana, CDN dashboards) collecting hits/misses periodically.
- What is miss rate?
- Miss rate = 100% β hit ratio. Same information from the other side β how much traffic reaches origin.