Skip to content

[WIP][DO NOT REVIEW] bench: add router CPU fast-path baseline harness - #290

Draft
jiannan-17 wants to merge 2 commits into
vllm-project:mainfrom
jiannan-17:bench/router-overhead-baseline
Draft

jiannan-17 wants to merge 2 commits into
vllm-project:mainfrom
jiannan-17:bench/router-overhead-baseline

Conversation

@jiannan-17

Copy link
Copy Markdown
Contributor

Purpose

Add benchmarks to measure router overhead before the tokenizer/L0 request-path integration in #244, following #270. No runtime behavior changes.

  • Criterion benchmarks for routing-key extraction, worker selection, and the tree-key formats discussed in [Bugfix] Content-aware routing should work with token ids #237.
  • An opt-in harness that runs the router against mock workers and reports client latency, throughput, router CPU time, and peak RSS. A direct-to-worker run provides a reference.

Both use a shared, deterministic corpus. Run instructions and measurement details are in docs/benchmarks/router_overhead.md. These benchmarks measure router overhead; routing benefits need real-worker measurements.

Test Plan

cargo test --test bench_corpus_test
cargo bench --bench routing_input -- --test
cargo bench --bench routing_input
cargo test --release --test router_overhead_bench -- --ignored --nocapture
cargo +1.95.0 clippy --all-targets --all-features -- -D warnings

Test Result

Validation recorded during implementation:

  • Corpus tests: 7 passed.
  • Criterion smoke run: all groups ran.
  • Clippy (Rust 1.95.0) and codespell: clean.

Benchmark measurements are pending. The tree-key format comparison also needs review before this is ready.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results

Add a reproducible baseline for what the router itself costs on the
request path, ahead of the tokenizer/L0 request-path integration
(roadmap vllm-project#244, Issue 1).

- tests/common/bench_corpus.rs: seeded prompt corpus (hot64, cold,
  mixed90, short_shared_prefix at 200 B / 2 KiB / 16 KiB) and request
  builders shared by the benchmark and the harness.
- benches/routing_input.rs: criterion groups for
  extract_text_for_routing, cache_aware / rendezvous_hash worker
  selection, and Tree insert/prefix_match cost for three candidate
  routing-key encodings.
- tests/router_overhead_bench.rs (#[ignore]): spawns the real
  vllm-router binary per scenario in front of in-process mock workers,
  drives closed-loop load, and reports client latency, throughput and
  the router's own CPU time and peak RSS via wait4(2). A direct_mock
  scenario gives the floor; means are subtracted, percentiles are
  reported side by side.
- tests/common/bench_mock.rs: a zero-delay worker without the capture
  store of MockWorker, so it stays flat under load.
- tests/bench_corpus_test.rs: CI guard that the corpus and mock build
  and stay deterministic.
- docs/benchmarks/router_overhead.md, scripts/run_benchmarks.py
  (--bench routing_input, --router-overhead), .buildkite/README.md.

No runtime code changes.

Signed-off-by: Jiannan Li <april.jiannanli@gmail.com>
- count warmup requests in router CPU per request
- draw corpus text from distinct bodies; add long_shared_prefix
- add repeats, rate cap, per-worker load share, router-only pinning
- avoid Tree drop leak and large-drop memory growth in criterion

Signed-off-by: Jiannan Li <april.jiannanli@gmail.com>
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