The Cache & Edge JournalCache & edge engineering

Topology › Performance Tuning

Performance Tuning

Policy cards filed under Performance Tuning.

Performance Tuning Is Your Cache Making You Slower? Tune Your Cache-Control Headers First LayerHTTP response caching at browser, shared proxy, and CDN edge layers controlled by Cache-Control headers TtlUse short TTLs for volatile or personalized content, longer TTLs for static assets; prefer stale-while-revalidate and stale-if-error to balance freshness and availability Hit rateAffected by freshness lifetime, revalidation support, request method, URL variance, Vary header correctness, and cacheability of responses Cache-Control headers are the primary control plane for HTTP caching, yet they are often set once and forgotten. Performance Tuning Why Your Cache Hit Rate Is Lying to You (and How to Fix It) LayerShared read-through cache in front of an origin data store, typically a key-value or HTTP response cache serving repeated reads. TtlShort TTLs for volatile data, longer TTLs for stable reference data; align TTL with the tolerance for stale reads rather than a single global value. Hit rateAffected by key cardinality, key normalization, request distribution skew, eviction pressure, TTL length, and whether writes invalidate or refresh entries. Cache hit rate is the most quoted number in performance tuning and one of the least trustworthy. Performance Tuning How to Tune Cache-Control Headers Without Breaking Your Load Balancer LayerShared HTTP response caching at the edge and in reverse proxies, coordinated with load balancer routing and health checks TtlShort for personalized or volatile responses, longer for static assets; use max-age with s-maxage for shared layers and revalidate via ETag or Last-Modified Hit rateDriven by URL and header normalization, Vary correctness, cache key design, freshness lifetime, and how much traffic repeats across nodes Cache-Control is a response header, but it is also a routing decision. Performance Tuning Cache or Load Balancer: Which Knob to Turn When Things Slow Down? LayerHTTP response caching at the edge and in shared reverse-proxy tiers, plus application-level object caching such as Redis-style key-value stores TtlShort for volatile data (seconds to minutes), long for immutable or fingerprinted assets (hours to days); always pair long TTLs with a versioned key or purge path Hit rateRequest pattern repetitiveness, key cardinality, cache key design, TTL length, eviction pressure, and how much of the working set fits in the allocated memory or disk When latency rises, the instinct is to reach for one of two controls: add caching, or add load balancing. Performance Tuning How Long Should Your Cache Live? A Practical Answer LayerShared HTTP response caches and in-process or remote key-value caches (object caches) sitting in front of origin application logic TtlShort for volatile, per-user, or rapidly changing data (seconds to minutes); long for stable, expensive-to-recompute, or shared content (hours to days), tuned per object class rather than globally Hit rateTraffic skew, key cardinality, request arrival rate, object size distribution, and how closely the TTL matches the natural change frequency of each object The question of how long a cache should live sounds like it has a single numeric answer, and almost every team eventually asks for one. Performance Tuning Can You Cache Dynamic Content at the CDN Edge? Yes, But You Gotta Watch the Details LayerReverse-proxy edge cache storing full HTTP responses for dynamic endpoints, keyed on URL plus selected request attributes such as cookies, headers, and query strings TtlStart short, often seconds to a couple of minutes, and extend only where measured staleness tolerance and upstream change frequency allow; vary TTL per endpoint class rather than applying one global value Hit rateDriven by response variability: how many distinct cache keys a URL fans out into, how personalized the payload is, how often upstream data changes, and how aggressively you normalize requests before lookup Dynamic content is usually defined by what it is not: it is not a static asset with a stable body and a long shelf life.

Other layers