From: Amaury Denoyelle Date: Wed, 19 Mar 2025 16:19:35 +0000 (+0100) Subject: MINOR: mux-quic: define config for max-data X-Git-Tag: v3.2-dev9~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68c10d444d729c6211f89535baccf179794b7486;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: define config for max-data 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. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index fa7d34be1..b928fa3db 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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 See also: fc_glitches +tune.quic.frontend.max-data-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 Sets the QUIC max_idle_timeout transport parameters in milliseconds for frontends which determines the period of time after which a connection silently diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index 922277695..3aa2c1edf 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -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; diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index b2551d8b6..01ff6dd69 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -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 }, diff --git a/src/haproxy.c b/src/haproxy.c index 1a7182811..6b1c6ce55 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -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, diff --git a/src/quic_tp.c b/src/quic_tp.c index 85d8fc9fc..8cb50c326 100644 --- a/src/quic_tp.c +++ b/src/quic_tp.c @@ -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;