Skip to content

Add Mint.HTTP2.set_window_size/3#480

Open
ericmj wants to merge 2 commits intomainfrom
ericmj/http2-connection-window-size
Open

Add Mint.HTTP2.set_window_size/3#480
ericmj wants to merge 2 commits intomainfrom
ericmj/http2-connection-window-size

Conversation

@ericmj
Copy link
Copy Markdown
Member

@ericmj ericmj commented Apr 12, 2026

Advertises a larger HTTP/2 receive window (connection-level or per-stream) by sending a WINDOW_UPDATE frame. Needed because RFC 7540 makes the connection-level initial window tunable only via WINDOW_UPDATE — not SETTINGS — leaving the spec default of 64 KB as the only reachable value without an API like this.

In hex's mix deps.get — many parallel multi-MB tarball downloads sharing one HTTP/2 connection — raising the connection window from 64 KB to 8 MB via this function drops 10 runs from 32.7s to 29.2s (10.8%). The time is for the whole mix deps.get command so the actual speed up for the HTTP requests is actually a higher percentage.

Deliberately asymmetric with get_window_size/2 (which returns the client send window). Docstrings on both carry warning callouts spelling out send-vs-receive so callers don't assume they round-trip.

Target is :connection or {:request, ref}; grow-only (shrink attempts return {:error, conn, %HTTPError{reason: :window_size_too_small}}); new_size validated against 1..2^31-1. Tracks the advertised peak on new receive_window_size fields on the connection and stream.

Advertises a larger HTTP/2 receive window (connection-level or
per-stream) by sending a WINDOW_UPDATE frame. Needed because RFC 7540
makes the connection-level initial window tunable only via
WINDOW_UPDATE — not SETTINGS — leaving the spec default of 64 KB as
the only reachable value without an API like this.

In hex's `mix deps.get` — many parallel multi-MB tarball downloads
sharing one HTTP/2 connection — raising the connection window from
64 KB to 8 MB via this function drops 10 runs from 32.7s to 29.2s
(10.8%), matching their HTTP/1 pool.

Deliberately asymmetric with get_window_size/2 (which returns the
client *send* window). Docstrings on both carry warning callouts
spelling out send-vs-receive so callers don't assume they round-trip.

Target is :connection or {:request, ref}; grow-only (shrink attempts
return {:error, conn, %HTTPError{reason: :window_size_too_small}});
new_size validated against 1..2^31-1. Tracks the advertised peak on
new receive_window_size fields on the connection and stream.
@ericmj ericmj force-pushed the ericmj/http2-connection-window-size branch from 8eb787d to 530f3ec Compare April 16, 2026 17:27
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage increased (+0.05%) to 87.684%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (20 of 22 lines covered, 90.91%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
lib/mint/http2.ex 22 20 90.91%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1494
Covered Lines: 1310
Line Coverage: 87.68%
Coverage Strength: 254.33 hits per line

💛 - Coveralls

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