This week in caching: micro-caching dynamic pages
Even 1-second caching crushes traffic spikes. Receipts:
— Logged-out news — a 1s nginx micro-cache (proxy_cache_valid 200 1s) during a viral spike collapsed 5,000 req/s down to ~1 origin hit/s per URL; content was at most 1 second stale and nobody could tell.
— Search results page — 10s micro-cache on a query-heavy endpoint cut DB load 95% during a campaign without showing visibly old data.
— API — 2s cache on an expensive aggregation turned a thundering herd into one computation per window.
The principle: micro-caching trades imperceptible freshness for massive origin offload. For anonymous pages it's almost free wins.
Bookmark: nginx proxy_cache + proxy_cache_lock — the lock prevents the herd from all recomputing on the same miss.
Cache Catch
@CacheCatch
This week in caching: micro-caching dynamic pages
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.