Skip to content

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 #2061

Closed

Description

@yigitdot

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

  1. Cache the outboard per fill session. Fetch {H}.obao4 once (or reuse the dispatcher's probe result) and hand it to BackendSource / origin_encode_range for every draw; add an Origin::fetch_range variant (or parameter) that takes a pre-fetched outboard.
  2. Minimum draw size. Have WindowPacer Wait until room reaches a floor (e.g. PULL_WINDOW_FLOOR or a fraction of the ramped window) instead of drawing every group that opens, so draw count is bounded by total / floor rather than total / CHUNK_BYTES. Exposure bound is unchanged — the window still caps pulled − served_paid.
  3. Prefetch the next draw while the current one serves, within the same window bound (follow-up; not required for B).
  4. 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

Activity

  1. added
    kind:feature
    area:node
    on Sep 19, 2026
  2. changed the title [-]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[/+] on Sep 19, 2026
  3. yigitdot commented on Sep 19, 2026

    @yigitdot
    ContributorAuthor

    §1 (outboard once per fill) and §2 (minimum draw of half the window) are implemented on feat/2060-stream-bounded-miss and 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).

  4. moved this from Backlog to Ready in deCDNon Sep 21, 2026
  5. self-assigned this
    on Sep 22, 2026
  6. moved this from Ready to In progress in deCDNon Sep 22, 2026
  7. moved this from In progress to Done in deCDNon Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:nodekind:feature

Type

No type

Fields

Priority

High

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions