Repository navigation
fix(cache,client-pull,node): stream cold two-leg misses at bandwidth (#2061) - #2116
Merged
Merged
Conversation
…2061) A proxy-warmed bundle pull fell from 40-60 MiB/s to 1-8 MiB/s once it reached content only one node could fill: every draw of the two-leg serve-miss spine re-read the whole {H}.obao4 outboard from the origin, and the window pacer opened a new upstream request for each small piece of room a voucher released. - cache: a 256 MiB outboard cache keyed by hash and tagged with the serving origin. The serviceability probe and every draw read it; each draw takes outboard and data from the same origin; a verify fault evicts the copy the draw used; a hit is length-checked. - client-pull: WindowPacer waits (WaitForMinDraw) until half a window of at least four pull-window floors is open, except for a serve-demand draw or the gap tail. Exposure bound unchanged. - cache/node: each origin read on the range-pull path gets a budget of node_pull_stall_window_sec plus its size at node_pull_min_throughput_bps. - metrics: decdn_cache_origin_range_timeouts_total and decdn_node_pull_through_min_draw_waits_total. - ADR 037, appendix-observability, config docs, CHANGELOG. Closes #2061 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Resolve the cache coalescing, zero-byte eviction, and gap-accounting issues.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Improves cold multi-GB pulls by reusing outboards, batching draws, and bounding origin reads.
Changes:
- Adds origin-affine, byte-bounded outboard caching.
- Enforces minimum draw sizes and adds pacing metrics.
- Adds origin-read budgets, tests, metrics, and documentation.
| File | Reviewed change |
|---|---|
crates/node/tests/origin_range_pull.rs |
Verifies one outboard request per pull. |
crates/node/src/runtime/mod.rs |
Wires origin-read budgets. |
crates/node/src/node_origin/pull_leg.rs |
Separates pacing wait metrics. |
crates/node/src/node_origin/backend_source.rs |
Updates origin failure messaging. |
crates/node/src/metrics.rs |
Adds minimum-draw metrics. |
crates/node/src/handlers/client/dispatch.rs |
Documents cached serviceability behavior. |
crates/common/src/config/types.rs |
Documents budget settings. |
crates/common/src/config/resolved.rs |
Documents resolved budget fields. |
crates/client-pull/src/pacer.rs |
Implements minimum-draw pacing. |
crates/client-pull/src/lib.rs |
Exports pacing APIs. |
crates/client-pull/src/driver.rs |
Handles wait reasons and adds tests. |
crates/cli/src/commands/config.rs |
Updates default configuration documentation. |
crates/cache/src/outboard_cache.rs |
Adds the bounded outboard cache. |
crates/cache/src/origin/mod.rs |
Updates the origin contract. |
crates/cache/src/origin_range.rs |
Adds cached outboards and read timeouts. |
crates/cache/src/metrics.rs |
Adds origin-timeout metrics. |
crates/cache/src/lib.rs |
Registers the cache module. |
crates/cache/src/engine.rs |
Integrates caching, fallback, and budgets. |
CHANGELOG.md |
Records the performance fix. |
adr/appendix-observability.md |
Documents new metrics. |
adr/037-regional-proxy-warming.md |
Updates range-pull behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Coverage reportTotal: 83.80% (was 83.69%, ▲ +0.11%) — 87606/104540 lines
History
|
…oard cache - Concurrent cold misses of one hash wait on a per-hash flight lock and reuse the first origin read's cached copy, so a burst of probes before claim_fill no longer multiplies outboard egress. - The outboard cache skips empty outboards (a one-group blob has none) and caps its entry count at 4096, bounding the map and the O(n) eviction scan. - build_cache is tested to wire the origin read budget from node_pull_stall_window_sec / node_pull_min_throughput_bps. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…_outboard Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
Sep 22, 2026
Resolve the #2116 × #1848 overlap in client-pull: - lib.rs re-exports: keep both the #1848 `downloader::{DownloadTarget, Downloader}` line and #2116's added `WaitReason` on the `driver` re-export. - #2116 gave `PacingWait::wait` a third `reason: WaitReason` arg (metering only). Update the two #1848 impls to the new signature: `ConsumedWait` (streamer.rs) and the `BumpConsumer` test double (scheduler.rs), taking `_reason` since neither meters. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Fixes #2061. A cold
decdn bundle pullof a multi-GB bundle started at 40–60 MiB/s and then fell to 1–8 MiB/s. That happened once the pull reached content that only one node (bcl) could fill from its origin. Grafana and Loki show the cause:PULL_WINDOW_FLOOR) and 5–66 MB. EveryPaceDecision::Drawindriveis a newsource.open().{H}.obao4again on each draw, ~19 MB for a 4.8 GB blob. It counted 25.2 GB ofpull_through_bytesfor 10.2 GB served.Changes
Outboard cache (
crates/cache/src/outboard_cache.rs,engine.rs,origin_range.rs)Minimum draw (
crates/client-pull/src/pacer.rs)MIN_DRAW_WINDOW(4 ×PULL_WINDOW_FLOOR),WindowPacerreturnsWaitForMinDrawuntil half the window is open.PacingWait::waitnow takes aWaitReason, so the two kinds of pause are counted separately.Origin read time budget
node_pull_stall_window_secplus its size atnode_pull_min_throughput_bps.min_throughput_bps = 0leaves these reads unbounded.New metrics
decdn_cache_origin_range_timeouts_totaldecdn_node_pull_through_min_draw_waits_total, counted separately fromwindow_pausedDocs: ADR 037, appendix-observability, the stall-window and min-throughput setting docs plus the
DEFAULT_CONFIGtemplate, and the CHANGELOG.Behaviour change: the dispatcher's check can now answer "yes" from a cached outboard without asking the origin. The live
origin_sizeprobe still confirms the data object exists. A later draw that the origin declines fails the stream after it is signed.Test plan
cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --check,cargo doc -D warnings,pre-commitcargo nextest run -p decdn-client-pull -p decdn-cache -p decdn-node -p decdn-common -p decdn-cli: 3236/3236drivetest with a large window, run with and without serve demand. Every open except the last is at least half the window, the number of opens is bounded, and the pull completes. It fails with the rule switched off..obao4GET for a whole-blob own-origin miss.bundle pull. On bcl,pull_through_bytesshould roughly match bytes served, and its upstream draws should no longer be ~1 MiB.Prefetching the next draw (#2061 §2.3) is left as a follow-up.
🤖 Generated with Claude Code