-
-
Notifications
You must be signed in to change notification settings - Fork 687
Open
Labels
enhancementNew feature or requestNew feature or request
Description
This would solve...
HTTP/2 is significantly slower for large/bursty asset downloads in some environments; tuning flow control fixes it.
The implementation should look like...
add http2InitialWindowSize + http2ConnectionWindowSize to Client.Options (and thus Pool/Agent).
I have also considered...
Using HTTP/1.1 which has other problems and using Node's http2 package, which works fine but I would loose a lot of features undici's fetch has out-of-the-box.
Additional context
By using this test script, downloading a 100MB file, I got the following results:
npm run compare
> [email protected] compare
> node scripts/compare-undici-fetch-http1-vs-http2.js
HTTP/2 Comparison
URL: https://mmatechnical.com/Download/Download-Test-File/(MMA)-100MB.zip
Node: v22.15.1
Undici: 7.16.0
HTTP/2 (default 64KB window)
============================================================
Concurrency: 20
Successful: 20/20
Status codes: {"200":20}
Total bytes: 2018.48MB
Average speed: 12.55MB/s
P50 latency: 92207.18ms
P95 latency: 160756.88ms
HTTP/2 (improved 8MB window)
============================================================
Concurrency: 20
Successful: 20/20
Status codes: {"200":20}
Total bytes: 2018.48MB
Average speed: 92.22MB/s
P50 latency: 14015.38ms
P95 latency: 21877.31ms
============================================================
COMPARISON
============================================================
HTTP/2 Tuned vs HTTP/2 Default: 7.35x faster
Throughput: 7.35x
HTTP/2 Default: 12.55MB/s
HTTP/2 Tuned: 92.22MB/s
My environment:
- Device: Macbook Pro, Apple M4, 16GB
- System Version: macOS 15.6 (24G84)
- Kernel Version: Darwin 24.6.0
manucorporat
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request