# CDN cache hit ratio above 80% for static assets

- **Pattern:** `ab-002030` (`performance-deep-dive.caching-cdn.cdn-cache-hit-ratio`)
- **Severity:** medium
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-002030
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-002030)

## Why it matters

A CDN cache hit ratio below 80% means most static asset requests are reaching your origin server rather than being served from an edge node. Each origin-served request adds 50–400ms of latency depending on user geography, and it multiplies your origin load. ISO 25010:2011 time-behaviour captures the latency cost; the operational consequence is higher infrastructure cost and slower asset delivery specifically for users furthest from your origin region.

## Severity rationale

Medium because a low cache hit ratio degrades performance for distant users and increases origin server load, but the impact is bounded to cacheable assets and does not affect correctness.

## Remediation

Audit your CDN analytics dashboard (Vercel Analytics, Cloudflare, CloudFront) and look for assets with high miss rates. The most common cause is incorrect `Cache-Control` headers — check that hashed assets carry `immutable, max-age=31536000`.

```json
// vercel.json — ensure immutable headers reach the CDN edge
{
  "headers": [
    {
      "source": "/_next/static/(.*)",
      "headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
    }
  ]
}
```

## Detection

- **ID:** `cdn-cache-hit-ratio`
- **Severity:** `medium`
- **What to look for:** Enumerate the CDN or edge caching configuration. Access CDN analytics dashboard (Vercel, Cloudflare, AWS CloudFront, etc.). Look for cache hit ratio metrics. A healthy hit ratio is above 80%.
- **Pass criteria:** CDN cache hit ratio for static assets is above 80%. Most requests are served from edge cache, not origin.
- **Fail criteria:** Cache hit ratio is below 80%, or CDN analytics are not available/not configured.
- **Skip (N/A) when:** The project does not use a CDN, or is too new to have meaningful cache statistics (requires 7+ days of traffic).

- **Cross-reference:** For cache header configuration that affects hit ratio, see `cache-control-hashed-assets`.
- **Detail on fail:** `"CDN cache hit ratio is 32% — most requests hitting origin server instead of cache edges"` or `"No CDN configured; all requests served from single origin region"`
- **Remediation:** Configure proper cache headers (see "Cache-Control headers optimized" check above). Ensure cache-busting works correctly so only changed assets are re-fetched.

  ```json
  // vercel.json — ensure proper headers for CDN caching
  { "headers": [{ "source": "/static/(.*)", "headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }] }] }
  ```

## External references

- iso-25010 time-behaviour

Taxons: performance

HTML version: https://auditbuffet.com/patterns/ab-002030
