Skip to content

Commit 135008a

Browse files
author
Grok Compression
committed
fetch: document HTTP/2 multiplexing tradeoffs in grk_stream_params
Explain when http2_multiplex helps (many small requests, good server support) vs. when it hurts (TCP head-of-line blocking, PIPEWAIT serialization, servers like CloudFerro that process multiplexed range requests sequentially).
1 parent 673f0ae commit 135008a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/lib/core/grok.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,24 @@ typedef struct _grk_stream_params
628628
/* 13 Fetch concurrency (0 = use default of 30) */
629629
uint32_t fetch_batch_size; /* max concurrent HTTP range requests */
630630

631-
/* 14 HTTP/2 multiplexing (0 = disabled, 1 = enabled) */
631+
/* 14 HTTP/2 multiplexing (default: disabled).
632+
* When enabled, all concurrent range requests share a single TCP connection
633+
* via CURLPIPE_MULTIPLEX + HTTP_VERSION_2TLS + PIPEWAIT.
634+
*
635+
* Trade-offs:
636+
* + Reduces connection overhead when issuing hundreds of small range requests
637+
* + Better for servers/CDNs with good HTTP/2 stream handling
638+
* - Single TCP connection means TCP-level head-of-line blocking: one packet
639+
* loss stalls ALL streams (vs. only one connection with HTTP/1.1)
640+
* - PIPEWAIT forces requests to queue behind the initial TLS handshake
641+
* instead of opening parallel connections immediately
642+
* - Some object stores (e.g. CloudFerro) process multiplexed range requests
643+
* sequentially, negating the concurrency benefit
644+
* - For a small number of range requests, the HTTP/2 framing and flow-control
645+
* overhead can make it 10-15% slower than parallel HTTP/1.1 connections
646+
*
647+
* Recommendation: leave disabled unless benchmarking shows a clear benefit
648+
* for your specific server and workload. */
632649
bool http2_multiplex;
633650

634651
} grk_stream_params;

0 commit comments

Comments
 (0)