Skip to content
WebsiteHosting.com

concept Delivery & performance

Request collapsing during cache stampedes

Simultaneous misses for one eligible cache key can share an origin fetch. Count the requests waiting on it as well as the calls saved: one failed fetch can affect the whole group.

Latest recorded source check · P0163

What it means

Request collapsing lets a cache make one fetch from the origin server for several simultaneous misses that can use the same response. One request starts the fetch, called a fill. The others wait for its result instead of starting their own fetches.

Timing matters. When a popular entry expires, many requests can arrive before the cache has a fresh response to offer any of them. If each miss starts a fetch, the origin gets a burst of duplicate work. That is how a cache stampede can overwhelm an origin. Collapsing reduces that work without guaranteeing that the fill will succeed.

Try it

Simulation. Switch Eligible same-key collapsing from on to off, leaving the nine simultaneous requests unchanged. Four need representation A and three need representation B. The cache entries have distinct, verified keys, and both have expired. The other two requests are private and cannot join either group in this example.

Request collapsing during cache stampedes

Explain why concurrent misses can overwhelm an origin and how coalescing changes work

Simulation
Modeled outcome: Fills

Each verified eligible key has its own hit/fill/waiter path; private traffic is not collapsed in this policy.

Request collapsing during cache stampedes: synthetic scenario inputs
Replaces all inputs with the documented starting example and the indicated change. Reset restores the starting example.
Sharing a fill within each cache key

Origin work

  1. Private calls2
  2. Total origin calls4
  3. Failed shared requests0
Key groupHitsrequestsOrigin callsrequestsWaitersrequestsFailedrequests
A0130
B0120

Hits, origin calls and waiting requests are separate counts. Requests in different groups are never collapsed together; failures are not reported as hits.

Evaluated inputs

Required scenario evidence
provided
Key/variant/privacy policy evidence
verified
Eligible requests for representation A
4 count
Representation A state
expired
Eligible same-key collapsing
on
Origin A outcome
success
Eligible requests for representation B
3 count
Representation B state
expired
Origin B outcome
success
Private/nonshareable requests
2 count

Closed batch of simultaneous requests. A/B are stipulated distinct, verified reusable keys including variant policy; private requests never share in this conservative policy. Expired treated as miss, no conditional revalidation/stale serving, Vary calculation, auth storage exceptions, live user data or retries. Fill outcome same for individual calls within a group when collapse off; private outcomes not evaluated.

About this model

The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.

Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.

Request groupCollapsing onCollapsing off
A: 4 requests1 origin call, 3 waiters4 origin calls, no waiters
B: 3 requests1 origin call, 2 waiters3 origin calls, no waiters
Private: 2 requests2 separate origin calls2 separate origin calls
Total4 origin calls9 origin calls

All seven A and B requests miss in both columns. The five calls saved with collapsing come from five requests waiting for work already in progress, not from five fresh cache hits. Both origin outcomes are set to success, so no A or B requests fail. The simulation counts private calls but does not evaluate their outcomes. Reset restores the original batch with collapsing on.

When one fill fails

Starting from Reset, change Representation B state to fresh. All three B requests are now cache hits: they neither start a fill nor wait for one. The selected origin outcome for B is not used. That leaves three origin calls: one for A and two for the private requests.

Now change only Origin A outcome to failure. The origin call count stays at three, but four requests fail: the request that started A’s fill and its three waiters. B’s three hits are unaffected. Counting failed origin calls alone would miss how many requests depended on that one fetch.

The failure count is a count of dependent requests, not the number of failed origin calls. With four requests for expired key A and collapsing on, one failed fill leaves all four requests in the modeled failure count. Key B and private traffic are accounted for separately. If A is fresh instead, the fill outcome for that group is not evaluated. This distinction helps when an origin-call graph improves but a client-error graph does not.

In practice

Before counting duplicate fetches, establish which requests can use the same response. A URL alone does not settle that question. For example, Vary: Accept-Language tells a cache to account for the request’s Accept-Language field when matching a stored response. If A and B are distinct language variants of one page, a fill for A is not a fill for B. Even a matching variant does not by itself establish permission to share a user-specific response.

The simulation takes the two eligible groups as given; it does not calculate variant matches or inspect user data. If the key, variant, or privacy policy is unknown, stop rather than combining requests by URL. Missing scenario evidence likewise means there is no result, not that there were zero origin calls.

This example treats expiry as a miss: it does not revalidate an entry, serve stale content, or retry a failed fill. It counts calls, not origin capacity. When examining a burst, identify the complete eligible key first, then count both the fetches and the requests that depended on them. Fewer calls can show less duplicate work; they cannot show that sharing was correct.

Frequently asked questions

Editorial questions based on the listed sources and explicitly labeled local examples.

Can requests for the same URL always share a fill?

No. Sharing must respect the applicable cache key, selected representation and reuse policy. Different variants or private contexts can require different treatment.

What happens if the common fill fails?

The dependent requests in that eligible key group can all fail even if only one origin fill ran. A failure count of four clients is not four origin calls. Fresh groups and other keys remain separate in the example.

Does request collapsing make a response cacheable?

No. Eligibility for reuse and storage follows the applicable cache policy. The lab supplies that evidence rather than treating a shared origin request as proof.

Does one fill eliminate all origin traffic?

No. There may be multiple keys, cache instances and unshareable requests. Here two expired keys each need one fill and every private request remains separate.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. RFC 9111: HTTP Caching

    4. HTTP caches may reuse eligible responses or collapse eligible requests. Cache keys and shared-cache restrictions, including unqualified private, remain relevant.

    Checked .

  2. RFC 9110: HTTP Semantics

    §12.5.5. Vary identifies request fields used to select the representation. A cache must account for those fields in reuse decisions; RFC 9111 provides cache matching and validation rules. Vary is not a cache lifetime.

    Checked .

Report an issue. Include the article URL and ID, not passwords or access keys.