]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: define config for max-data
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 19 Mar 2025 16:19:35 +0000 (17:19 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 25 Mar 2025 15:30:09 +0000 (16:30 +0100)
Define a new global configuration tune.quic.frontend.max-data. This
allows users to explicitely set the value for the corresponding QUIC TP
initial-max-data, with direct impact on haproxy memory consumption.

doc/configuration.txt
include/haproxy/global-t.h
src/cfgparse-quic.c
src/haproxy.c
src/quic_tp.c

index fa7d34be150530365656bf6e51531fbdf2d2f998..b928fa3dbcc8a6912a05b682a9c0109c73a3f4c1 100644 (file)
@@ -1691,6 +1691,7 @@ The following keywords are supported in the "global" section :
    - tune.quic.disable-tx-pacing
    - tune.quic.disable-udp-gso
    - tune.quic.frontend.glitches-threshold
+   - tune.quic.frontend.max-data-size
    - tune.quic.frontend.max-idle-timeout
    - tune.quic.frontend.max-streams-bidi
    - tune.quic.frontend.default-max-window-size
@@ -4336,6 +4337,18 @@ tune.quic.frontend.glitches-threshold <number>
 
   See also: fc_glitches
 
+tune.quic.frontend.max-data-size <size>
+  This setting is the hard limit for the number of data bytes in flight over a
+  QUIC frontend connection. It is reused as the value for the initial_max_data
+  transport parameter. It directly impacts the upload bandwidth for the peer
+  depending on the latency and the per-connection memory consumption in
+  haproxy.
+
+  By default, the value is set to 0, which indicates that it must be
+  automatically generated as the product between max-streams-bidi and bufsize.
+  This can be increased for example if a backend application relies on massive
+  uploads over high latency networks.
+
 tune.quic.frontend.max-idle-timeout <timeout>
   Sets the QUIC max_idle_timeout transport parameters in milliseconds for
   frontends which determines the period of time after which a connection silently
index 922277695cb93925bf81c90bf643725991345880..3aa2c1edfeed9de730b4800956672c669f8c46ae 100644 (file)
@@ -213,6 +213,7 @@ struct global {
                unsigned int quic_backend_max_idle_timeout;
                unsigned int quic_frontend_max_idle_timeout;
                unsigned int quic_frontend_glitches_threshold;
+               unsigned int quic_frontend_max_data;
                unsigned int quic_frontend_max_streams_bidi;
                size_t quic_frontend_max_window_size;
                unsigned int quic_retry_threshold;
index b2551d8b6330950478e9d9ffdc8a1ca2b37784e0..01ff6dd69863d8baf300552c3525c809ffe0befa 100644 (file)
@@ -282,7 +282,7 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type,
 {
        unsigned int arg = 0;
        int prefix_len = strlen("tune.quic.");
-       const char *suffix;
+       const char *suffix, *errptr;
 
        if (too_many_args(1, args, err, NULL))
                return -1;
@@ -305,6 +305,15 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type,
        }
        else if (strcmp(suffix, "frontend.glitches-threshold") == 0)
                global.tune.quic_frontend_glitches_threshold = arg;
+       else if (strcmp(suffix, "frontend.max-data-size") == 0) {
+               if ((errptr = parse_size_err(args[1], &arg))) {
+                       memprintf(err, "'%s': unexpected charater '%c' in size argument '%s'.",
+                                 args[0], *errptr, args[1]);
+                       return -1;
+               }
+
+               global.tune.quic_frontend_max_data = arg;
+       }
        else if (strcmp(suffix, "frontend.max-streams-bidi") == 0)
                global.tune.quic_frontend_max_streams_bidi = arg;
        else if (strcmp(suffix, "frontend.default-max-window-size") == 0) {
@@ -411,6 +420,7 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.cc.cubic.min-losses", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.conn-tx-buffers.limit", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.glitches-threshold", cfg_parse_quic_tune_setting },
+       { CFG_GLOBAL, "tune.quic.frontend.max-data-size", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.max-streams-bidi", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.max-idle-timeout", cfg_parse_quic_time },
        { CFG_GLOBAL, "tune.quic.frontend.default-max-window-size", cfg_parse_quic_tune_setting },
index 1a718281105aa35d894afe8ead5ecffb4414ac1e..6b1c6ce55226e5bb0031ad61d5eec998b358614c 100644 (file)
@@ -196,6 +196,7 @@ struct global global = {
 #ifdef USE_QUIC
                .quic_backend_max_idle_timeout = QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT,
                .quic_frontend_max_idle_timeout = QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT,
+               .quic_frontend_max_data = 0,
                .quic_frontend_max_streams_bidi = QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI,
                .quic_frontend_max_window_size = QUIC_DFLT_MAX_WINDOW_SIZE,
                .quic_reorder_ratio = QUIC_DFLT_REORDER_RATIO,
index 85d8fc9fcaffc3f1e7ab136009f182e2dcb52a20..8cb50c326608481b4e1de3c8f50df8a205165a16 100644 (file)
@@ -67,10 +67,14 @@ void quic_transport_params_init(struct quic_transport_params *p, int server)
        p->initial_max_streams_bidi = max_streams_bidi;
        p->initial_max_streams_uni  = max_streams_uni;
 
-       /* Set connection flow-control data limit, automatically calculated
-        * from max number of concurrently opened streams.
+       /* Set connection flow-control data limit, either from configuration,
+        * or automatically calculated from max number of concurrently opened
+        * streams.
         */
-       p->initial_max_data = max_streams_bidi * stream_rx_bufsz;
+       if (global.tune.quic_frontend_max_data)
+               p->initial_max_data = global.tune.quic_frontend_max_data;
+       else
+               p->initial_max_data = max_streams_bidi * stream_rx_bufsz;
 
        /* Set remote streams flow-control data limit. */
        p->initial_max_stream_data_bidi_remote = stream_rx_bufsz * QMUX_STREAM_RX_BUF_FACTOR;