]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic/config: adapt settings to new conn buffer limit
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 14 Aug 2024 09:07:13 +0000 (11:07 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 20 Aug 2024 15:59:35 +0000 (17:59 +0200)
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.

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

index d7fbb465514a0121372ace024ba432e2f362280e..58037ebbf4f6ba180400ed7ccf7dbdcb4216d9ca 100644 (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.
+
+  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 0.
+  The default value is 480k.
 
   See also the "quic-cc-algo" bind option.
 
index 16da286c41ed6d2ea8fbf64272420cf03d5185f0..abafd459738d987ccf27ec3bb0d60d13a36fec40 100644 (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;
index 5ac3f1ff4669584e96165ff232796be1f82b7356..8a4ed58be14b9b841b8546ab5a9aa036e4d40303 100644 (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
index e869da50d20e6f216ea127d1c4d607f6a2f247e4..31168ad8703caa6bcbaa69186db793c1ce6d2b46 100644 (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 },
index 7ab540e90e96d758ac082454d05ae1b96231a7f4..a2bd2a446909a286ac5bbdb5b0fc59ef217809bb 100644 (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
index d5609086c68bb62b290588021a10a5a7ceec1723..d32551a24d012ba946e9df52574467aa3c24bc37 100644 (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);