http2: add new connectionWindowSize option - #65619
Open
pimterry wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
Signed-off-by: Tim Perry <pimterry@gmail.com>
pimterry
force-pushed
the
http2-connection-window-size-option
branch
from
August 28, 2026 15:17
6e6d342 to
137d777
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65619 +/- ##
==========================================
- Coverage 90.07% 90.06% -0.01%
==========================================
Files 751 751
Lines 254881 254932 +51
Branches 48111 48124 +13
==========================================
+ Hits 229582 229603 +21
- Misses 16486 16496 +10
- Partials 8813 8833 +20
🚀 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.
#64623 massively increased the default HTTP/2 connection window size from 64KB bytes to 32MB.
This is definitely a good thing for bandwidth in common scenarios, but there's no way for users to opt-out of this change or to shrink the window themselves for other use cases.
That limitation is because the only way to change this today is through
setLocalWindowSize, which is only available for dynamic changes after connection setup. Unfortunately, once an HTTP/2 connection is set up it's impossible to shrink the initial window back below the advertised amount (impossible in the protocol, not just our implementation), so changes only apply once the initial window has been used up. With a default of 32MB per session, that can take a while.Shrinking the window can be useful as a quick workaround to preserve old behaviour, or to optimize for low-latency connections or constrained memory environments, where you want smaller buffers & more responsive backpressure instead of a huge window optimized for throughput over high-latency.
This PR adds a new HTTP/2
connectionWindowSizeoption to let you configure the initial connection window. If set, it overrides the initial window that's configured on nghttp2 before the session connects.En route this also commonizes some option validation into
validateSessionOptions, deduplicating some existing validation and giving a single place to add the validation for this new option.