1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-09-16 09:36:18 +02:00

Tune HTTP/2 client for performance

This commit is contained in:
DarthSim
2025-08-30 21:54:35 +03:00
parent 7cc9620cf7
commit 215fcfee1c

View File

@@ -36,6 +36,10 @@ func New(verifyNetworks bool) (*http.Transport, error) {
ExpectContinueTimeout: 1 * time.Second, ExpectContinueTimeout: 1 * time.Second,
ForceAttemptHTTP2: false, ForceAttemptHTTP2: false,
DisableCompression: true, DisableCompression: true,
HTTP2: &http.HTTP2Config{
MaxReceiveBufferPerStream: 128 * 1024,
},
} }
if config.ClientKeepAliveTimeout <= 0 { if config.ClientKeepAliveTimeout <= 0 {
@@ -52,6 +56,8 @@ func New(verifyNetworks bool) (*http.Transport, error) {
return nil, err return nil, err
} }
// TODO: Move this to transport.HTTP2 when https://go.dev/issue/67813 is closed
transport2.MaxReadFrameSize = 16 * 1024
transport2.PingTimeout = 5 * time.Second transport2.PingTimeout = 5 * time.Second
transport2.ReadIdleTimeout = time.Second transport2.ReadIdleTimeout = time.Second