perf: let the upload connections buffer writes again - #19
Merged
Merged
Conversation
The 8 KiB write-buffer cap kept the upload total from counting bytes hyper had queued but not sent, at the price of a write syscall per 16 KiB frame. The total is now capped at what the connections have written, which bounds the same error and leaves the buffers alone. Over TLS that ceiling is what the session accepted rather than what the socket took, which meter.rs spells out; a test pins that a stalled peer's body is not counted as sent.
BKPepe
force-pushed
the
perf/upload-buffer
branch
from
September 27, 2026 07:10
57f595c to
469f6d5
Compare
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 audit capped the upload client's write buffer at 8 KiB so the total could not count bytes hyper had queued but not sent. Measured, that cap costs a write syscall per 16 KiB frame: 61 writes per MB against 3.8 uncapped, because hyper batches up to 16 buffers per
writev.The total is now capped at what the connections have written instead, so the buffers can go back to their defaults. On loopback over plain HTTP the upload path goes from about 0.51 to 0.22 ms of CPU per MB. Two tests pin the accounting, one on a stalled peer and one over TLS; both fail without the change.
Still to confirm on armv7 hardware, where the earlier regression was measured.