From: Amaury Denoyelle Date: Wed, 14 Aug 2024 09:07:44 +0000 (+0200) Subject: MEDIUM: h3: allocate small buffers for headers frames X-Git-Tag: v3.1-dev6~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b355e89bf9cfc0c0ae4fffdc033bb59ea75a37c0;p=thirdparty%2Fhaproxy.git MEDIUM: h3: allocate small buffers for headers frames 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. --- diff --git a/src/h3.c b/src/h3.c index 794c30ff84..17afa1edbd 100644 --- 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;