Skip to content

perf: let the upload connections buffer writes again - #19

Merged
BKPepe merged 1 commit into
masterfrom
perf/upload-buffer
Sep 27, 2026
Merged

BKPepe merged 1 commit into
masterfrom
perf/upload-buffer

Conversation

@BKPepe

@BKPepe BKPepe commented Sep 27, 2026

Copy link
Copy Markdown
Member

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.

Copilot AI lite review requested due to automatic review settings September 27, 2026 06:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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
BKPepe merged commit d0decf9 into master Sep 27, 2026
18 checks passed
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.

2 participants