Repository navigation
Description
Summary
The two-leg serve-miss spine (serve_via_backend_origin / serve_via_window_pull_through) has three defects in its pull leg that are cheap today — the CLI only touches the spine with a throwaway (0,0) open it drops immediately — but become the dominant cost the moment large whole-blob and resumed requests route through it (#2060 option B). B should not ship without at least the first two fixed.
1. The outboard is re-downloaded on every draw
BackendSource::open (crates/node/src/node_origin/backend_source.rs:100-157) → CacheEngine::origin_encode_range (crates/cache/src/engine.rs:3605-3638) → Origin::fetch_range, which fetches the sibling {H}.obao4 first on every call ("Outboard first", crates/cache/src/origin/http.rs:393-406; same shape in s3.rs / fs.rs). No outboard cache exists anywhere in crates/.
A 13 GB blob has a ~50 MB outboard (blob/256). See §2 for the draw count: that is ~10 GB to ~650 GB of outboard egress per cold pull of a 13 GB file, i.e. up to 50× the content itself. Dispatch already has the outboard in hand at dispatch.rs:1001 (origin_fetch_outboard_bytes) and throws it away.
2. Draws are sized to whatever room opened — often ~1 MiB
RampPacer → WindowPacer::decide (crates/client-pull/src/pacer.rs:264-313, :337-346) draws min(up_to_bytes, room) with no minimum draw size; the only floor is the serve_demand liveness case (PULL_WINDOW_FLOOR, pacer.rs:56). The client pays one voucher per CHUNK_BYTES (1 MiB) of wire, and each voucher wakes the pull leg (serve_leg.rs:329-337 → DownstreamWait) with ~1 MiB of new room.
- Origin faster than the client: steady-state draws collapse to ~1 MiB → ~13,000 sequential origin GET pairs for a 13 GB blob.
- Origin slower than the client: vouchers batch and draws grow toward
credit_max(64 MiB,crates/common/src/config/mod.rs:420) → ~200 GET pairs.
Either way the pull is RTT-bound, not bandwidth-bound, and the client receives nothing while a draw is in flight. A single draw whose GET + verify exceeds the client's --stall-timeout-ms (30 s default) still trips PullStalled (crates/client-pull/src/lib.rs:2586).
3. No timeout on the origin leg
origin_encode_range has no tokio::time::timeout. The HTTP origin carries its own header/idle bounds (http.rs:29-42); S3 has none and retries are disabled (s3.rs:269). A stuck GET parks the serve leg until the client's stall clock fires and the disconnect cancels the pull — the failure self-heals only by the client giving up.
Proposed fix
- Cache the outboard per fill session. Fetch
{H}.obao4once (or reuse the dispatcher's probe result) and hand it toBackendSource/origin_encode_rangefor every draw; add anOrigin::fetch_rangevariant (or parameter) that takes a pre-fetched outboard. - Minimum draw size. Have
WindowPacerWaituntil room reaches a floor (e.g.PULL_WINDOW_FLOORor a fraction of the ramped window) instead of drawing every group that opens, so draw count is bounded bytotal / floorrather thantotal / CHUNK_BYTES. Exposure bound is unchanged — the window still capspulled − served_paid. - Prefetch the next draw while the current one serves, within the same window bound (follow-up; not required for B).
- Bound the origin leg with a per-draw timeout matching the other fill tiers (
node_pull_timeout_sec).
Blocks: #2060 (option B).
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
[-]two-leg spine: cold-miss pull leg is stop-and-go — one sequential origin round trip per credit window, no prefetch overlap[/-][+]two-leg spine: pull leg re-fetches the outboard per draw, draws collapse to ~1 MiB, and the origin leg has no timeout — must land before #2060 option B[/+]yigitdot commentedon Sep 19, 2026
§1 (outboard once per fill) and §2 (minimum draw of half the window) are implemented on
feat/2060-stream-bounded-missand ship in the #2060 PR, ahead of the dispatch-gate removal in that series. §3 (prefetch the next draw) and §4 (per-draw origin-leg timeout) stay open here; the PR references this issue rather than closing it.Related: #2062 (observer attached ahead of a stalled owner), #2063 (CLI throwaway prelude open claims a fill).
feat(node,client-pull): meter batching waits apart from window backpr…
test(node): close the review's spine coverage gaps
revert: move the #2061 pull-leg cost fixes out of this PR
feat(node): stream bounded and resumed cache-miss requests through th…