Repository navigation
Add optional parallel UDP writers and reuse subgroup inboxes - #126
Merged
Merged
Conversation
Add opt-in two-writer Linux batching with stable destination affinity, duplicated socket handles, a fixed total queue budget, and coordinated deadline/close handling. Keep one writer as the default. Reuse bounded, empty subgroup inbox storage after drain/termination with a producer barrier that prevents stale writers touching recycled queues. Verified regression controls: serial dispatch fails the parallel-progress test; fresh-only allocation fails the inbox-reuse test. Restored code passes both under race detection. Protocol/conventions review found no issues.
floatdrop
marked this pull request as ready for review
November 6, 2026 11:40
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.
The shared UDP batch writer can occupy one core while a relay still has CPU headroom. Add opt-in two-writer Linux batching through
WithUDPSendWriters(2)/-udp-send-writers 2, using duplicated handles to the same socket and stable destination affinity. One writer remains the default, and the total queue budget stays 256.Reuse subgroup inbox storage only after its writer has drained or terminated. A separate close signal and producer/recycle lock barrier prevent late producers from touching a new subgroup. Retention is bounded to 1024 empty queues with capacity at most 256. The focused 64-object inbox lifecycle benchmark decreases from 6720 to 576 B/op; this is not a whole-relay allocation reduction.
Validation: full native race suite, vet/build, CI-pinned golangci-lint 2.14, quick allocation guards and benchmark smoke; Linux GSO/ECN/source metadata, raw QUIC/WebTransport, deadline, fallback, listener drain and socket-release tests with upstream and application QUIC forks. Serial-dispatch and no-reuse negative controls fail the intended regressions. Protocol/conventions review found no issues.
Relay load and playback measurements remain necessary before enabling the new writer count in production.