Benchmark broker fan-out and buffer dispatch#24
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #24 +/- ##
==========================================
- Coverage 88.26% 87.00% -1.26%
==========================================
Files 18 18
Lines 1193 1193
==========================================
- Hits 1053 1038 -15
Misses 108 108
- Partials 32 47 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What changed
BenchmarkBrokerDispatchbenchmark ininternal/sshConn/message_test.goto measure broker fan-outcost without SSH/session noise
Brokerto use a size-1 per-host channel buffer ininternal/sshConn/message.goWhy it changed
The broker dispatch path was a plausible scaling risk because it fans each request out through per-host channels sequentially. Rather than changing it blindly, this PR first adds measurement coverage and then applies the smallest production change supported by the data.
Using repeated benchmark runs and
benchstat, the size-1 buffer showed:hosts_1:+3.72%slowerhosts_8:-11.54%fasterhosts_32: no statistically significant change (p=0.063)hosts_128:-29.68%fasterThat makes a one-slot buffer a reasonable low-complexity tradeoff for fan-out workloads.
Impact
Validation
go test ./internal/sshConngo test ./...go test -run '^$' -bench '^BenchmarkBrokerDispatch$' -benchmem ./internal/sshConngo test -run '^$' -bench '^BenchmarkBrokerDispatch/unbuffered' -benchmem -count=10 ./internal/sshConngo test -run '^$' -bench '^BenchmarkBrokerDispatch/buffered_1' -benchmem -count=10 ./internal/sshConnbenchstat /tmp/pretty-broker-unbuffered.norm.txt /tmp/pretty-broker-buffered1.norm.txtRoot cause
Before this change,
Brokerused unbuffered per-host channels, so fan-out remained synchronously coupled to eachworker's ability to receive the next request. A small buffer reduces that coupling without introducing a broader
redesign.