]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: h3: allocate small buffers for headers frames
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 14 Aug 2024 09:07:44 +0000 (11:07 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 20 Aug 2024 16:12:27 +0000 (18:12 +0200)
A major change was recently implemented to change QUIC MUX Tx buffer
allocation limit, which is now based on the current connection
congestion window size. As this size may be smaller than the previous
static value, it is likely that the limit will be reached more
frequently.

When using HTTP/3, the majority of requests streams are used for small
object exchanges. Every responses start with a HEADERS frames which
should be much smaller in size than the default buffer. But as the whole
buffer size is accounted against the congestion window, a single stream
can block others even if only emitting a single HEADERS frame which is
suboptimal for bandwith usage, if the congestion window is small enough.

To adapt to this new situation, rely on the newly available small
buffers to transfer HEADERS frame response. This at least guarantee that
several parallel streams could allocate their own buffer for the first
part of the response, even with a small congestion window.

The situation could be further improve to use various indication on the
data size and select a small buffer if sufficient. This could be done
for example via the Content-length value or HTX extra field. However
this must be the subject of a dedicated patch.

src/h3.c

index 794c30ff848af551ea289c742f26277d6ad2d963..17afa1edbdf7b7df0bf90fcb35e5fddc42d0ca74 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -1606,7 +1606,7 @@ static int h3_resp_headers_send(struct qcs *qcs, struct htx *htx)
 
        list[hdr].n = ist("");
 
-       if (!(res = qcc_get_stream_txbuf(qcs, &err, 0))) {
+       if (!(res = qcc_get_stream_txbuf(qcs, &err, 1))) {
                if (err) {
                        TRACE_ERROR("cannot allocate Tx buffer", H3_EV_TX_FRAME|H3_EV_TX_HDR, qcs->qcc->conn, qcs);
                        goto err;