{
    "name": "Cache Hit Ratio Calculator",
    "url": "https://calculators.geekmidst.com/calculators/cache-hit-ratio-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/cache-hit-ratio-calculator.md",
    "category": "Software, cloud & AI",
    "description": "Calculate a cache hit ratio and miss ratio from hits and misses, and the average response time when hits and misses have different latencies.",
    "summary": "Hit ratio = hits ÷ (hits + misses). With hit and miss latencies, the average response time is the hit ratio × hit time + miss ratio × miss time.",
    "also_called": [
        "Cache hit rate calculator",
        "CDN offload calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "hits",
            "label": "Cache hits",
            "type": "number",
            "default": "9500"
        },
        {
            "name": "misses",
            "label": "Cache misses",
            "type": "number",
            "default": "500"
        },
        {
            "name": "hit_ms",
            "label": "Latency on a hit",
            "type": "number",
            "default": "1",
            "unit": "ms",
            "optional": true
        },
        {
            "name": "miss_ms",
            "label": "Latency on a miss",
            "type": "number",
            "default": "50",
            "unit": "ms",
            "optional": true
        }
    ],
    "outputs": [
        {
            "key": "hit_ratio",
            "label": "Hit ratio",
            "format": "percent"
        },
        {
            "key": "miss_ratio",
            "label": "Miss ratio",
            "format": "percent"
        },
        {
            "key": "total_requests",
            "label": "Total requests",
            "format": "integer"
        },
        {
            "key": "avg_latency_ms",
            "label": "Average latency",
            "format": "number"
        }
    ],
    "formula": {
        "text": "Hit ratio = Hits ÷ (Hits + Misses);  Average latency = H × Hit latency + (1 − H) × Miss latency",
        "variables": {
            "H": "hit ratio as a decimal"
        }
    },
    "worked_example": {
        "inputs": {
            "hits": "9500",
            "misses": "500",
            "hit_ms": "1",
            "miss_ms": "50"
        },
        "steps": [
            "Hit ratio: 9,500 ÷ 10,000 = 95%.",
            "Average latency: 0.95 × 1 + 0.05 × 50 = 0.95 + 2.5 = 3.45 ms."
        ],
        "result": "9,500 hits out of 10,000 requests is a 95% hit ratio, giving an average latency of 3.45 ms."
    },
    "interpretation": "Look at the miss ratio rather than the hit ratio: going from 95% to 99% hits cuts misses, and load on the origin, by 80%. Misses usually dominate average latency.",
    "assumptions": [
        "Every hit and every miss takes the average time entered."
    ],
    "limitations": [
        "Byte hit ratio (share of bytes served from cache) can differ a lot from request hit ratio when large files are cached less often."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "What is a good hit ratio?",
            "answer": "It depends on the cache. Static-asset CDNs often aim very high; application caches with personalised data are lower. Track it over time rather than against a fixed target."
        },
        {
            "question": "Where do I find hits and misses?",
            "answer": "Redis reports keyspace_hits and keyspace_misses in INFO stats; CDNs show cache status in their analytics or response headers."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "CDN Bandwidth Cost Calculator",
            "url": "https://calculators.geekmidst.com/calculators/cdn-bandwidth-cost-calculator"
        },
        {
            "name": "P95 Latency Calculator",
            "url": "https://calculators.geekmidst.com/calculators/p95-latency-calculator"
        },
        {
            "name": "Percentage Calculator",
            "url": "https://calculators.geekmidst.com/calculators/percentage-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}