cache: Coalesce in-flight identical upstream fetches #52

Merged
linus merged 1 commits from cache/coalesce-inflight-fetches into develop 2026-09-08 15:19:26 -05:00
Collaborator

Why

A depot chunk miss under several clients at once can stampede Steam CDNs (same object, N upstream GETs). In-flight coalescing already existed on the miss path, but acceptance still lacked a gated concurrent test (without a hold, later clients can become sequential HITs after the first fill) and the Quick check metrics table omitted cache_coalesced.

What changed

  • steamcache/coalesce_test.go: N concurrent identical GETs share one upstream fill (leader MISS, waiters HIT-COALESCED, same body); 5xx sibling asserts shared failure without N origin storms.
  • README.md: document cache_coalesced in the Quick check metrics table and a short prose note next to the other hit/miss fields.

No production path rewrite — same coalescer / handler wiring; no new APIs; out of scope for #31 HEAD and multi-tier design.

How tested

/usr/local/bin/go test ./steamcache/ -count=1
/usr/local/bin/go test ./steamcache/ -count=3 -run 'TestCoalesceIdenticalMiss'

Risks / rollback

Test + docs only relative to existing coalescing. Revert the commit to roll back.

Fixes #35

## Why A depot chunk miss under several clients at once can stampede Steam CDNs (same object, N upstream GETs). In-flight coalescing already existed on the miss path, but acceptance still lacked a gated concurrent test (without a hold, later clients can become sequential HITs after the first fill) and the Quick check metrics table omitted `cache_coalesced`. ## What changed - `steamcache/coalesce_test.go`: N concurrent identical GETs share one upstream fill (leader `MISS`, waiters `HIT-COALESCED`, same body); 5xx sibling asserts shared failure without N origin storms. - `README.md`: document `cache_coalesced` in the Quick check metrics table and a short prose note next to the other hit/miss fields. No production path rewrite — same coalescer / handler wiring; no new APIs; out of scope for #31 HEAD and multi-tier design. ## How tested ```bash /usr/local/bin/go test ./steamcache/ -count=1 /usr/local/bin/go test ./steamcache/ -count=3 -run 'TestCoalesceIdenticalMiss' ``` ## Risks / rollback Test + docs only relative to existing coalescing. Revert the commit to roll back. Fixes #35
ash added 1 commit 2026-09-08 15:01:23 -05:00
cache: Coalesce in-flight identical upstream fetches
CI / vulncheck (pull_request) Successful in 14s
CI / check-and-test (pull_request) Successful in 48s
ea195993de
In-flight coalescing already dedups identical misses, but acceptance
still lacked a gated test (without a hold, waiters can become sequential
HITs after the first fill) and the Quick check metrics table omitted
cache_coalesced.

Add steamcache/coalesce_test.go: N concurrent identical GETs share one
upstream fill (leader MISS, waiters HIT-COALESCED) and a 5xx sibling.
Document cache_coalesced next to the other hit/miss fields.

Fixes #35
ash requested review from linus 2026-09-08 15:01:23 -05:00
linus merged commit a3ea4806a7 into develop 2026-09-08 15:19:26 -05:00
linus deleted branch cache/coalesce-inflight-fetches 2026-09-08 15:19:26 -05:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: s1d3sw1ped/steamcache2#52