Commit 21f089e
fix(h2-transport): enlarge flow-control windows to prevent large-download stalls
The HTTP/2 protocol default flow-control window is 64 KB per stream and 64 KB
at the session level. With a ~60 ms round-trip time to api.runloop.pro, this
caps effective throughput at roughly 1 MB/s regardless of actual link capacity.
Fix both levels:
- Send SETTINGS_INITIAL_WINDOW_SIZE = 16 MB so each new stream starts with a
16 MB send window (stream level).
- Call session.setLocalWindowSize(16 MB) after connect so the server can push
up to 16 MB of response body before waiting for a WINDOW_UPDATE (session
level).
Measured impact: 10 MB file download throughput went from ~1 MB/s to ~89 MB/s
(~3× faster than the HTTP/1.1 path).
Also add two TypeScript casts in arrayBuffer() to satisfy the compiler: Node.js
Buffers are always backed by a regular ArrayBuffer (not SharedArrayBuffer), so
the casts are sound.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 5ffbad5 commit 21f089e
2 files changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
60 | 61 | | |
61 | | - | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
| |||
0 commit comments