Skip to content

test: stress benchmarks for concurrent rate limit and fanout (closes #388)#485

Merged
evantahler merged 2 commits into
mainfrom
evantahler/stress-bench-388
Apr 30, 2026
Merged

test: stress benchmarks for concurrent rate limit and fanout (closes #388)#485
evantahler merged 2 commits into
mainfrom
evantahler/stress-bench-388

Conversation

@evantahler

Copy link
Copy Markdown
Member

Summary

  • Adds rateLimit.bench.test.ts: 1000 concurrent hits on one identifier asserting an exact 20/980 allowed/denied split, 10-identifier isolation, and a checkRateLimit() per-call latency bench (~25k req/s on the dev box).
  • Adds fanout.bench.test.ts: 500 children dispatched across 8 workers asserting no drops or dupes, mixed success/failure batches with no cross-batch leakage, and 50 concurrent fanOut calls of 10 children each.
  • Closes Stress-test concurrent rate limit and fanout #388. Both files live under example/backend/__tests__/benchmark/ so they run in the existing dedicated benchmark CI job.

Test plan

  • `bun benchmark` — all 10 benches pass (4 transports + 3 fanout + 3 rate limit), ~4.2s wall-clock
  • 3× back-to-back stability runs — deterministic, no flakes
  • `bun lint` clean across all workspaces
  • CI `benchmark` job green
  • CI `test-example-backend` shards green (the existing `find` glob picks up `*.bench.test.ts` too, mirroring the existing transports bench)

evantahler and others added 2 commits April 30, 2026 08:10
Adds two benchmark files covering the concurrency-sensitive paths
flagged in #388. The rate-limit bench fires 1000 concurrent calls at
one identifier and asserts an exact 20/980 allowed/denied split, plus
checkRateLimit() per-call latency. The fanout bench dispatches 500
children across 8 workers and asserts no drops or dupes, plus mixed
success/failure batches and 50 concurrent fanOut calls of 10 children
each. Both run only via bun benchmark in their dedicated CI job.

closes #388

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pulls Stats, computeStats, and printStats out of all three bench files
into example/backend/__tests__/benchmark/stats.ts. printStats now takes
an optional thresholdMs and suppresses the throughput line on
single-iteration runs (where 1/duration is not a meaningful rate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@evantahler evantahler merged commit b1cbecb into main Apr 30, 2026
15 checks passed
@evantahler evantahler deleted the evantahler/stress-bench-388 branch April 30, 2026 15:27
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.

Stress-test concurrent rate limit and fanout

1 participant