MINOR: quic/config: adapt settings to new conn buffer limit

QUIC MUX buffer allocation limit is now directly based on the underlying
congestion window size. previous static limit based on conn-tx-buffers
is now unused. As such, this commit adds a warning to users to prevent
that it is now obsolete.

Secondly, update max-window-size setting. It is now the main entrypoint
to limit both the maximum congestion window size and the number of QUIC
MUX allocated buffer on emission. Remove its special value '0' which was
used to automatically adjust it on now unused conn-tx-buffers.
This commit is contained in:
Amaury Denoyelle 2024-08-14 11:07:13 +02:00
parent aeb8c1ddc3
commit 1de5f718cf
6 changed files with 31 additions and 66 deletions

View File

@ -1505,7 +1505,6 @@ The following keywords are supported in the "global" section :
- tune.pt.zero-copy-forwarding
- tune.quic.cc-hystart
- tune.quic.disable-udp-gso
- tune.quic.frontend.conn-tx-buffers.limit
- tune.quic.frontend.glitches-threshold
- tune.quic.frontend.max-idle-timeout
- tune.quic.frontend.max-streams-bidi
@ -3897,13 +3896,6 @@ tune.quic.disable-udp-gso
transfer. It may be useful to disable it on developers suggestion when
suspecting an issue on emission.
tune.quic.frontend.conn-tx-buffers.limit <number>
This settings defines the maximum number of buffers allocated for a QUIC
connection on data emission. By default, it is set to 30. QUIC buffers are
drained on ACK reception. This setting has a direct impact on the throughput
and memory consumption and can be adjusted according to an estimated round
time-trip. Each buffer is tune.bufsize.
tune.quic.frontend.glitches-threshold <number>
Sets the threshold for the number of glitches on a frontend connection, where
that connection will automatically be killed. This allows to automatically
@ -3938,11 +3930,13 @@ tune.quic.frontend.max-streams-bidi <number>
tune.quic.frontend.max-window-size <size>
Sets the default maximum window size for the congestion controller of a
single QUIC connection. The value must be written as an integer with an
optional suffix 'k', 'm' or 'g'. It must be between 10k and 4g. Alternatively,
the special value 0 can be used to automatically derive the value from
"quic.frontend.conn-tx-buffers.limit".
optional suffix 'k', 'm' or 'g'. It must be between 10k and 4g.
The default value is 0.
QUIC multiplexer also uses the current congestion window size to determine if
it can allocate new stream buffers on data emission. As such, the maximum
congestion window size also serves as a limit on this allocator.
The default value is 480k.
See also the "quic-cc-algo" bind option.

View File

@ -202,7 +202,6 @@ struct global {
size_t quic_frontend_max_window_size;
unsigned int quic_retry_threshold;
unsigned int quic_reorder_ratio;
unsigned int quic_streams_buf;
unsigned int quic_max_frame_loss;
#endif /* USE_QUIC */
} tune;

View File

@ -97,8 +97,8 @@ typedef unsigned long long ull;
#define QUIC_DFLT_REORDER_RATIO 50 /* in percent */
/* Default limit of loss detection on a single frame. If exceeded, connection is closed. */
#define QUIC_DFLT_MAX_FRAME_LOSS 10
/* Default congestion window size. 0 has a special value based on global.tune.quic_streams_buf */
#define QUIC_DFLT_MAX_WINDOW_SIZE 0
/* Default congestion window size. 480 kB, equivalent to the legacy value which was 30*bufsize */
#define QUIC_DFLT_MAX_WINDOW_SIZE 491520
/*
* 0 1 2 3

View File

@ -236,7 +236,8 @@ static int cfg_parse_quic_time(char **args, int section_type,
}
/* Parse any tune.quic.* setting with strictly positive integer values.
* Return -1 on alert, or 0 if succeeded.
*
* Returns 0 on success, >0 on warning, <0 on fatal error.
*/
static int cfg_parse_quic_tune_setting(char **args, int section_type,
struct proxy *curpx,
@ -259,12 +260,29 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type,
}
suffix = args[0] + prefix_len;
if (strcmp(suffix, "frontend.conn-tx-buffers.limit") == 0)
global.tune.quic_streams_buf = arg;
if (strcmp(suffix, "frontend.conn-tx-buffers.limit") == 0) {
memprintf(err, "'%s' keyword is now obsolote and has no effect. "
"Use 'tune.quic.frontend.max-window-size' to limit Tx buffer allocation per connection.", args[0]);
return 1;
}
else if (strcmp(suffix, "frontend.glitches-threshold") == 0)
global.tune.quic_frontend_glitches_threshold = arg;
else if (strcmp(suffix, "frontend.max-streams-bidi") == 0)
global.tune.quic_frontend_max_streams_bidi = arg;
else if (strcmp(suffix, "frontend.max-window-size") == 0) {
unsigned long cwnd;
char *end_opt;
cwnd = parse_window_size(args[0], args[1], &end_opt, err);
if (!cwnd)
return -1;
if (*end_opt != '\0') {
memprintf(err, "'%s' : expects an integer value with an optional suffix 'k', 'm' or 'g'", args[0]);
return -1;
}
global.tune.quic_frontend_max_window_size = cwnd;
}
else if (strcmp(suffix, "max-frame-loss") == 0)
global.tune.quic_max_frame_loss = arg;
else if (strcmp(suffix, "reorder-ratio") == 0) {
@ -285,48 +303,6 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type,
return 0;
}
/* Parse any tune.quic.* setting accepting any integer values.
* Return -1 on alert, or 0 if succeeded.
*/
static int cfg_parse_quic_tune_setting1(char **args, int section_type,
struct proxy *curpx,
const struct proxy *defpx,
const char *file, int line, char **err)
{
int prefix_len = strlen("tune.quic.");
const char *suffix;
if (too_many_args(1, args, err, NULL))
return -1;
suffix = args[0] + prefix_len;
if (strcmp(suffix, "frontend.max-window-size") == 0) {
unsigned long cwnd;
char *end_opt;
if (strcmp(args[1], "0") == 0) {
/* 0 is a special value to set the limit based on quic_streams_buf */
cwnd = 0;
}
else {
cwnd = parse_window_size(args[0], args[1], &end_opt, err);
if (!cwnd)
return -1;
if (*end_opt != '\0') {
memprintf(err, "'%s' : expects an integer value with an optional suffix 'k', 'm' or 'g'", args[0]);
return -1;
}
}
global.tune.quic_frontend_max_window_size = cwnd;
}
else {
memprintf(err, "'%s' keyword not unhandled (please report this bug).", args[0]);
return -1;
}
return 0;
}
static int cfg_parse_quic_tune_setting0(char **args, int section_type,
struct proxy *curpx,
const struct proxy *defpx,
@ -396,7 +372,7 @@ static struct cfg_kw_list cfg_kws = {ILH, {
{ CFG_GLOBAL, "tune.quic.frontend.glitches-threshold", 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.max-window-size", cfg_parse_quic_tune_setting1 },
{ CFG_GLOBAL, "tune.quic.frontend.max-window-size", cfg_parse_quic_tune_setting },
{ CFG_GLOBAL, "tune.quic.max-frame-loss", cfg_parse_quic_tune_setting },
{ CFG_GLOBAL, "tune.quic.reorder-ratio", cfg_parse_quic_tune_setting },
{ CFG_GLOBAL, "tune.quic.retry-threshold", cfg_parse_quic_tune_setting },

View File

@ -204,7 +204,6 @@ struct global global = {
.quic_reorder_ratio = QUIC_DFLT_REORDER_RATIO,
.quic_retry_threshold = QUIC_DFLT_RETRY_THRESHOLD,
.quic_max_frame_loss = QUIC_DFLT_MAX_FRAME_LOSS,
.quic_streams_buf = 30,
#endif /* USE_QUIC */
},
#ifdef USE_OPENSSL

View File

@ -2035,10 +2035,7 @@ struct bind_conf *bind_conf_alloc(struct proxy *fe, const char *file,
#ifdef USE_QUIC
/* Use connection socket for QUIC by default. */
bind_conf->quic_mode = QUIC_SOCK_MODE_CONN;
bind_conf->max_cwnd =
global.tune.quic_frontend_max_window_size ?
global.tune.quic_frontend_max_window_size :
global.tune.bufsize * global.tune.quic_streams_buf;
bind_conf->max_cwnd = global.tune.quic_frontend_max_window_size;
#endif
LIST_INIT(&bind_conf->listeners);