The Stampede Problem
When a popular object expires, many users may request it at the same instant. Without protection, each miss triggers its own origin fetch, hammering the origin. This burst is called a cache stampede or dog pile.
Request Collapsing
Request collapsing lets a cache merge concurrent misses for the same key.
- The first miss starts a single fetch to the next tier or origin.
- Later requests for the same object wait on that in flight fetch.
- When the response arrives, all waiting requests are served from it.
So a thousand simultaneous misses produce one origin request, not a thousand.
Why It Works
- Origin protection: a sudden surge becomes a single fetch.
- Consistency: every waiting client gets the same fresh copy.
- Efficiency: bandwidth and origin compute are saved.
Boundaries And Care
Collapsing only merges requests that share the same cache key. Differing query strings or vary dimensions split into separate fetches. Designers keep keys clean so collapsing actually triggers.
A slow origin response means many clients wait together, so the platform usually caps how long a collapsed wait may last before it gives up or serves stale.
Key idea
Request collapsing merges concurrent misses for one key into a single origin fetch, so a stampede on an expiring object becomes one request that fills everyone.