Skip to content

perf(cli): settle the probe round 250 ms after the first verified holder - #2297

Merged
alpergundogdu merged 1 commit into
mainfrom
claude/probe-first-good-holder
Oct 2, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
claude/probe-first-good-holder

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Summary

probe_and_order waited for every probe (join_all), so one slow connect held the fetch for up to the 5 s probe timeout. On the testnet, one node's first connect takes about 1.7 s, while two holders answer within 170 ms.

  • Cutoff. The round ends PROBE_SETTLE_AFTER_HOLDER (250 ms) after the first verified holder answers, or when every probe has answered. A holder that answers later is either about 125 ms farther away or still connecting, so it would not lead the order.
  • Verified holders only. Each probe verifies and classifies its own answer (classify_probe → ProbeOutcome), so a fast answer with a bad signature cannot cut the round short.
  • No holder: no change. The round still waits for every probe, so a cold blob sees every reachable pull-through target.
  • Dropped holders stay reachable through the fetch's later discovery.
  • Logging. Each probe's outcome and elapsed time logs at debug, plus a line for how many probes the cutoff dropped.
  • Refactor. The tally moves into ProbeTally, which drops the cognitive_complexity / too_many_lines expectation on probe_and_order.
  • Bundle pulls use the same probe_and_order, so they get the cutoff too.

Measurement

decdn fetch --rediscover of a 543 KiB blob on the testnet. Probe round = resolved_ms − probe_start_ms from the fetch timings event.

probe round (ms)
main 390, 427, 1542, 1868 (the slow runs sampled the slow-connecting node)
this branch 285–429 across 9 runs; 1–2 probes dropped per run in the last 5

Test plan

  • settle_probes unit tests on a paused clock: keeps answers inside the grace; drops a straggler and returns at first holder + 250 ms; waits for every probe without a holder
  • cargo clippy --workspace --all-targets --all-features
  • cargo nextest run -p decdn-cli
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • cargo test --no-run -p decdn-e2e --features anvil-e2e
  • Manual --rediscover fetches against the testnet

🤖 Generated with Claude Code

probe_and_order waited for every probe with join_all, so one slow
connect held the fetch for up to the 5 s probe timeout. On the testnet
one node's first connect takes about 1.7 s while two holders answer
within 170 ms.

Each probe now verifies and classifies its own answer, and the round
ends 250 ms after the first verified holder answers, or when every probe
has answered. A round with no holder still waits for every probe, so a
cold blob sees every reachable pull-through target. A dropped holder
stays reachable through the fetch's later discovery.

Each probe's outcome and elapsed time log at debug.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit b17f0e5 in the claude/probe-first-g... branch remains at 87%, unchanged from commit c2fae66 in the main branch.

Show a line coverage summary of the most impacted files.
File main c2fae66 claude/probe-first-g... b17f0e5 +/-
crates/node/src...nt/serve_leg.rs 93% 91% -2%
crates/cli/src/...mmands/fetch.rs 76% 75% -1%
crates/incentiv...eth_identity.rs 99% 98% -1%
crates/node/src/dht/publish.rs 92% 92% 0%
crates/cache/src/engine.rs 94% 95% +1%

@alpergundogdu
alpergundogdu added this pull request to stack #2301 October 2, 2026 12:20
@alpergundogdu
alpergundogdu merged commit 2366118 into main Oct 2, 2026
30 of 31 checks passed
@alpergundogdu
alpergundogdu deleted the claude/probe-first-good-holder branch October 2, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants