Skip to content

bench: add flow control regression repro#919

Draft
brentechols wants to merge 1 commit into
hyperium:sean/bye-bye-big-mutexfrom
brentechols:pr917-flow-control-bench
Draft

bench: add flow control regression repro#919
brentechols wants to merge 1 commit into
hyperium:sean/bye-bye-big-mutexfrom
brentechols:pr917-flow-control-bench

Conversation

@brentechols

Copy link
Copy Markdown

Adds a standalone benchmark for the single-connection flow-control shape that showed the large regression while evaluating #917.

Default shape:

  • requests=300
  • connections=1
  • streams_per_connection=8
  • response_size=1048576
  • stream_window_size=65535
  • connection_window_size=65535
  • worker_threads=8
  • nodelay=false

Run with:

cargo bench --bench flow_control_repro

The shape can be adjusted with H2_BENCH_* environment variables for request count, connection count, streams, body sizes, windows, worker threads, idle/spin delay, and TCP_NODELAY.

This uses only the repo's existing dependencies/dev-dependencies; no new external crate is required.

Local validation:

  • cargo fmt --check
  • cargo check --benches
  • cargo bench --bench flow_control_repro
    • completed=300
    • requests_per_second=34.971
    • latency_p95_us=324883.900

@brentechols brentechols force-pushed the pr917-flow-control-bench branch from 3545e6f to 321be65 Compare July 6, 2026 02:20
@brentechols

Copy link
Copy Markdown
Author

Updated run with the corrected checked-in benchmark shape.

The benchmark now keeps the in-flight response futures inside the connection task, matching the local repro harness. The earlier draft PR body result came from a spawned-response-task shape and should be ignored.

Slow configuration:

H2_BENCH_REQUESTS=300
H2_BENCH_CONNECTIONS=1
H2_BENCH_STREAMS=8
H2_BENCH_RESPONSE_SIZE=1048576
H2_BENCH_STREAM_WINDOW_SIZE=65535
H2_BENCH_CONNECTION_WINDOW_SIZE=65535
H2_BENCH_WORKER_THREADS=8
H2_BENCH_NODELAY=false
cargo bench --bench flow_control_repro

Results from this machine:

code elapsed_ms requests_per_second latency_p50_us latency_p95_us latency_p99_us bytes
master (21211d0) + this benchmark 613.642 488.884 9039.200 32150.500 61184.700 314572800
#917 (c970de5) + this benchmark (321be65) 4213.694 71.196 109290.500 172660.000 220014.200 314572800

That puts #917 at ~0.146x the master baseline for this shape, or about 6.9x slower.

Validation after updating the benchmark:

No new external dependencies are required; this uses the existing repo dependency set.

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