Topology › Caching Strategies
Caching Strategies
Policy cards filed under Caching Strategies.
Caching Strategies
Stop Setting Max-Age: Use stale-while-revalidate for Cache Control
LayerHTTP response caching at shared proxies, CDN edge nodes, and browser caches governed by Cache-Control directives
TtlShort max-age for freshness plus a longer stale-while-revalidate window during which stale copies may be served while revalidation happens
Hit rateAffected by how long responses remain usable, whether revalidation is required before reuse, how many distinct URLs and variants exist, and how often origin content changes
Most cache control advice reduces to a single instruction: set a max-age and let the clock decide when content is fresh.
Caching Strategies
Stop Blaming the Load Balancer: Fix Your Cache Key First
LayerHTTP response caching at the edge or reverse proxy layer, keyed by request attributes
TtlSet TTL based on content volatility and tolerance for staleness; use short TTLs for frequently changing data, longer for stable assets, and consider stale-while-revalidate patterns
Hit ratePrimarily determined by cache key design, request normalization, and the diversity of query parameters, headers, and cookies included in the key
When latency spikes or origin load climbs, the load balancer is often the first suspect.
Caching Strategies
Cache Like a Pro: A Field Guide for the Overworked Architect
LayerApplication-level read-through cache with a distributed key-value store, often paired with an in-process cache for hot keys.
TtlShort TTLs (seconds to minutes) for volatile data, longer TTLs (hours to days) for stable reference data, tuned to freshness requirements.
Hit rateKey distribution, request locality, cache size relative to working set, eviction policy, and TTL all influence the hit rate.
Caching is the art of keeping a copy of data closer to where it is needed, trading memory and staleness for speed and reduced load on origin systems.
Caching Strategies
Five Caching Myths That Are Slowing Down Your Site
LayerShared HTTP response caching at the edge and reverse-proxy layer, plus application-level object caching for computed data
TtlLong TTLs for immutable, fingerprinted assets; short TTLs for personalized or fast-changing responses; add stale-while-revalidate where freshness can lag slightly
Hit rateRequest diversity, key design, cacheable-response ratio, TTL length, eviction pressure, and how much of the working set fits in memory
Caching advice travels well because it sounds universal, and that is exactly why so much of it is wrong in practice.
Caching Strategies
Cache-Aside vs. Write-Through: Which Caching Strategy Wins?
LayerApplication-level cache in front of a primary data store, typically a key-value store such as Redis or an in-process cache, used for read-heavy object lookups.
TtlUse a TTL as a safety net rather than the primary freshness mechanism: short TTLs for volatile or user-specific data, longer TTLs for stable reference data, plus jitter to avoid synchronized expiry storms.
Hit rateDominated by access skew, key cardinality, working-set size versus cache capacity, and TTL length; write-through can lower hit rate for cold or rarely re-read keys because it populates entries that may never be read again.
Cache-aside and write-through are two ways to keep a cache and a primary data store consistent, and they differ mainly in who is responsible for filling and updating the cache.
Caching Strategies
Why Your Cache Strategy Is Backwards: Rethink the Edge First
LayerEdge caching layer, typically a reverse proxy or CDN point of presence, sitting in front of origin infrastructure.
TtlUse short TTLs for frequently changing content and longer TTLs for stable assets, tuning based on observed change frequency and tolerance for staleness.
Hit rateHit rate is influenced by request distribution, cache key design, TTL, content variability, and how well the edge can normalize and coalesce requests.
Most caching advice starts at the origin and works outward.
Caching Strategies
Caching Myths That Are Killing Your Hit Ratio (And What to Do)
LayerShared HTTP response cache (reverse proxy / edge layer) sitting in front of an origin application, keyed by request URL plus selected request headers
TtlLong TTLs for content-addressed immutable assets; short TTLs with stale-while-revalidate for semi-dynamic pages; near-zero or no-store for per-user and authenticated responses
Hit rateDriven by key cardinality, cacheability of responses, eviction pressure relative to working-set size, request distribution skew, and how much of the traffic is genuinely repeatable
Hit ratio is the fraction of requests served without touching the origin.
Caching Strategies
Why Your Cache Isn't Hitting 95% and What to Do About It
LayerShared reverse-proxy or application-level response cache sitting in front of origin services, keyed on request attributes such as URL, method, headers, and cookies.
TtlSet TTL from object change frequency and tolerance for staleness, not from a target hit ratio; hot stable objects can live long, volatile or personalized ones should be short or uncacheable.
Hit rateDriven by key cardinality, request distribution skew, cacheable response share, TTL length relative to request frequency, eviction pressure from working-set size, and how many requests are bypassed or personalized.
A cache hit ratio is a symptom, not a goal.
Caching Strategies
Caching Isn't a Set-and-Forget Toggle: Rethink Your Edge Strategy
LayerEdge caching layer that stores HTTP responses close to users, typically for static assets and cacheable API responses.
TtlShort TTLs (seconds to minutes) for dynamic content; longer TTLs (hours to days) for static assets; balance freshness and hit rate.
Hit rateAffected by content popularity, cache key design, TTL, request diversity, and geographic distribution of users.
Caching at the edge is often treated as a simple switch: enable it, set a time-to-live, and walk away.
Caching Strategies
Stop Guessing Your Cache TTL: A Case for Stale-While-Revalidate
LayerShared HTTP response caches sitting between clients and origin servers, including reverse proxies, edge caches, and browser caches that honor standard freshness and revalidation directives.
TtlShort freshness windows for volatile content, longer windows for stable assets, with a stale-while-revalidate window sized to how long the origin can tolerate serving slightly old data.
Hit rateDominated by how well the cache key matches real request variation, how long entries stay fresh, and how much of the traffic is genuinely repeatable rather than personalized or randomized.
Most teams pick a time-to-live by feel.
Caching Strategies
Should You Cache That? A Decision Framework for HTTP Responses
LayerHTTP response caching at shared reverse-proxy or edge layers, plus private browser caches, distinguished by cacheability and keying rules
TtlShort for volatile or personalized-adjacent content, long for immutable fingerprinted assets; align TTL with how often the underlying data actually changes rather than with a default value
Hit rateDriven by request distribution, URL and key cardinality, query-string and header variance, Vary correctness, personalization, and how well TTLs match content change frequency
Caching an HTTP response is a bet that the same request will recur and that the answer will still be correct when it does.