test: stress benchmarks for concurrent rate limit and fanout (closes #388)#485
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rateLimit.bench.test.ts: 1000 concurrent hits on one identifier asserting an exact 20/980 allowed/denied split, 10-identifier isolation, and acheckRateLimit()per-call latency bench (~25k req/s on the dev box).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 concurrentfanOutcalls of 10 children each.example/backend/__tests__/benchmark/so they run in the existing dedicatedbenchmarkCI job.Test plan