Skip to content

feat(cli,node): measure time to first byte by phase - #2294

Merged
alpergundogdu merged 1 commit into
mainfrom
claude/ttfb-optimization-client-delays-18fdc0
Oct 2, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
claude/ttfb-optimization-client-delays-18fdc0

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Summary

Measures where time to first byte (TTFB) goes, on both ends of a paid fetch. No behaviour changes.

Node. FirstByteClock splits the existing serve TTFB into three sibling histograms. They record only for streams that write a first frame, so the phases sum to the existing decdn_serve_first_byte_{hit,miss}_seconds totals.

Histogram Phase
decdn_serve_admission_seconds request decoded → load-shed admit, including the getPool/getAuthorization reads on a cache miss
decdn_serve_response_{hit,miss}_seconds admit → signed StreamResponse written; origin probes or upstream setup on a miss
decdn_serve_first_frame_{hit,miss}_seconds response → first frame written, i.e. the 1 MiB fill
  • A debug event, serve first byte, carries the three phases for each serve.
  • The new series have rows in adr/appendix-observability.md and a "Serve time to first byte by phase" panel in dashboard-delivery.json.

Client. decdn fetch logs one fetch timings info event (RUST_LOG=info or -v). It gives milliseconds since start to each mark: endpoint bound, probe start, holders resolved, signer unlocked, first lane ready, first byte. It logs on success, failure and Ctrl-C. bundle pull does not log it.

Baseline from the testnet

  • Cold peer store: the probe round takes 1.8 s of a 2.4 s fetch.
  • Warm peer store: setup is about 26 ms.
  • 108 MiB blob, warm: first byte to a file in 263 ms; to stdout in 1.3-1.7 s. Stdout waits for the 4 MiB ingest checkpoint.

Test plan

  • cargo clippy --workspace --all-targets --all-features
  • cargo nextest run -p decdn-cli -p decdn-node: 2426 pass. One unrelated flaky test passed on retry.
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • cargo test --no-run -p decdn-e2e --features anvil-e2e
  • Manual fetches against the testnet, to a file and to stdout

🤖 Generated with Claude Code

The node splits its serve time-to-first-byte into admission, response
and first-frame phases, each a sibling histogram, with a debug event per
serve. The delivery dashboard charts the phases.

decdn fetch logs one `fetch timings` info event with the milliseconds
to each mark: endpoint bound, probe start, holders resolved, signer
unlocked, first lane ready, first byte. RUST_LOG=info shows it.

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

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 d944a56 in the claude/ttfb-optimiza... branch remains at 87%, unchanged from commit 41b6830 in the main branch.

Show a line coverage summary of the most impacted files.
File main 41b6830 claude/ttfb-optimiza... d944a56 +/-
crates/cli/src/...mmands/fetch.rs 77% 76% -1%
crates/node/src/dht/publish.rs 92% 92% 0%
crates/client/src/lib.rs 92% 92% 0%
crates/client/src/scheduler.rs 95% 95% 0%
crates/node/src...s/client/mod.rs 95% 95% 0%
crates/client/s...c/connection.rs 97% 97% 0%
crates/cli/src/.../bundle_pull.rs 81% 81% 0%
crates/node/src...ent/dispatch.rs 83% 84% +1%
crates/incentiv...eth_identity.rs 98% 99% +1%
crates/cli/src/...etch_timings.rs 0% 98% +98%

@alpergundogdu
alpergundogdu merged commit fb6d655 into main Oct 2, 2026
30 of 31 checks passed
@alpergundogdu
alpergundogdu deleted the claude/ttfb-optimization-client-delays-18fdc0 branch October 2, 2026 09:41
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