Practical Edge Caching Patterns for Content-Heavy Sites
How stale-while-revalidate headers, cache keys, and immutable static assets keep p95 latency under 40ms across global regions.
Modern web performance rarely hinges on shaving milliseconds off a single database query; more often, it comes down to deciding which responses never need to hit the origin at all.
1. Separate Mutable HTML from Immutable Assets
Content-hashed CSS, fonts, and SVG sprites should carry Cache-Control: public, max-age=31536000, immutable. HTML documents, by contrast, benefit from short edge TTLs paired with stale-while-revalidate so visitors never wait on origin re-renders.
2. Keep Cache Keys Minimal
Marketing query parameters such as utm_source or ref fragment edge caches unnecessarily. Stripping non-functional query strings before cache lookup routinely improves cache hit ratios by 15–25%.
3. Measure Tail Latency, Not Averages
Average response time hides cold starts and regional misses. Always track p95 and p99 latency per geography when tuning cache headers.