Skip to content

perf(bench): add quoting bench for measuring DHT-lookup latency#55

Open
grumbach wants to merge 1 commit intoWithAutonomi:mainfrom
grumbach:perf/quoting-bench
Open

perf(bench): add quoting bench for measuring DHT-lookup latency#55
grumbach wants to merge 1 commit intoWithAutonomi:mainfrom
grumbach:perf/quoting-bench

Conversation

@grumbach
Copy link
Copy Markdown
Contributor

Summary

What it does

Measures the quoting phase only — no payment, no wallet, no EVM. Picks random target addresses, calls find_closest_peers, fires concurrent ChunkQuoteRequest or MerkleCandidateQuoteRequest, collects responses. Per-stage timing + summary stats. Optional JSON dump for cross-run comparison.

cargo run --release --example bench-quoting -- \
    --mode normal|merkle|both \
    --reps N [--concurrency N] \
    [--rep-timeout-secs N] [--tag T] [--json-out PATH] \
    [--bootstrap ip:port,...]

Bootstrap peers default to resources/bootstrap_peers.toml shipped in the repo; override with --bootstrap.

Why

When I started digging into slow uploads yesterday, I needed a way to isolate the quoting phase from everything else (encryption, payment, storage RPC). This bench does that, and gives enough granularity (p50/p95 per stage, per-peer timing) to point at the actual slow stage.

The first bench run nailed it: on mainnet, find_closest_peers p50 = 75s of an 80s total rep. Quote RPCs themselves were 280ms p50. The fix (saorsa-labs/saorsa-core#96) cut find_closest_peers p50 to 33s and lifted rep success from 40% to 100%.

Test plan

  • cargo build --release --example bench-quoting clean
  • Runs against mainnet with the production bootstrap_peers.toml
  • JSON output schema stable for cross-run diffing (baseline vs fix)

Not in scope

Standalone example binary that times the client-side quoting phase
against a live network — both single-node `ChunkQuoteRequest` and
merkle `MerkleCandidateQuoteRequest` paths, with fine-grained
per-stage latency (bootstrap, `find_closest_peers`, per-peer quote
RPC p50/p95/max, total). No payment, no wallet, no EVM — quoting
only.

Used this bench to confirm `find_closest_peers` was eating >90% of
quoting latency on mainnet (p50 75s of 80s total) and to validate
the fix in saorsa-labs/saorsa-core#96 (2.3× speedup on the
`find_closest_peers` stage, 10/10 rep success rate vs 4/10 on
baseline).

CLI:
  cargo run --release --example bench-quoting -- \
    --mode normal|merkle|both \
    --reps N [--concurrency N] [--rep-timeout-secs N] \
    [--tag T] [--json-out PATH] [--bootstrap ip:port,...]

Per-stage output to stdout; optional JSON dump for cross-run comparison.
Loads bootstrap peers from `resources/bootstrap_peers.toml` by default.
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.

1 participant