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.
This commit is contained in:
Amaury Denoyelle 2025-03-19 17:19:35 +01:00
parent 1f1a18e318
commit 68c10d444d
5 changed files with 33 additions and 4 deletions

View 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

View 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;

View 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 },

View 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,

View 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;