Skip to content

Commit de86fd1

Browse files
committed
MINOR: cfgparse-quic: activate pacing only via burst argument
Recently, pacing support was added for cubic congestion algorithm. This was activated by using the new token "cubic-pacing" on quic-cc-algo. Furthermore, it was possible to define a burst size with a new parameters after congestion token between parenthesis. This configuration is not oblivious to users. In particular, it can cause to easily forgot to tweak burst size, which can dramatically impact performance. Simplify this by removing the extra "-pacing" suffix. Now, pacing will be activated solely based on the burst parameter. If 0, burst is considered as infinite and no pacing will be used. Pacing will be activating for any positive burst. This better reflects the link between pacing and burst and its importance. Note that for the moment, if burst is specified, it will be ignored with a warning for algorithm outside of cubic. This is not a breaking change as pacing support was implemented in the current dev version.
1 parent 7b23c90 commit de86fd1

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

doc/configuration.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17206,40 +17206,41 @@ proto <name>
1720617206
instance, it is possible to force the http/2 on clear TCP by specifying "proto
1720717207
h2" on the bind line.
1720817208

17209-
quic-cc-algo { cubic[-pacing] | newreno | bbr | nocc }[(<args,...>)]
17209+
quic-cc-algo { cubic | newreno | bbr | nocc }[(<args,...>)]
1721017210
This is a QUIC specific setting to select the congestion control algorithm
1721117211
for any connection attempts to the configured QUIC listeners. They are similar
1721217212
to those used by TCP.
1721317213

1721417214
Default value: cubic
1721517215

1721617216
It is possible to active pacing if the algorithm is compatible. This is done
17217-
by using the suffix "-pacing" after the algorithm name. Pacing purpose is to
17218-
smooth emission of data without burst to reduce network loss. In some
17219-
scenario, it can significantly improve network throughput. However, it can
17220-
also increase CPU usage if haproxy is forced to wait too long between each
17221-
emission. Pacing support is still experimental, as such it requires
17222-
"expose-experimental-directives". BBR congestion control algorithm depends on
17223-
the pacing support which is in this case implicitely activated by "bbr".
17224-
Note that BBR haproxy implementation is still considered as experimental and
17225-
cannot be enabled without "expose-experimental-directives".
17217+
by specifying optional burst argument as described in the next paragraph.
17218+
Pacing purpose is to smooth emission of data without burst to reduce network
17219+
loss. In some scenario, it can significantly improve network throughput.
17220+
However, it can also increase CPU usage if haproxy is forced to wait too long
17221+
between each emission. Pacing support is still experimental, as such it
17222+
requires "expose-experimental-directives". BBR congestion control algorithm
17223+
depends on the pacing support which is in this case implicitely activated by
17224+
"bbr". Note that BBR haproxy implementation is still considered as
17225+
experimental and cannot be enabled without "expose-experimental-directives".
1722617226

1722717227
For further customization, a list of parameters can be specified after the
1722817228
algorithm token. It must be written between parenthesis, separated by a comma
1722917229
operator. Each argument is optional and can be empty if needed. Here is the
1723017230
mandatory order of each parameters :
1723117231
- maximum window size in bytes. It must be greater than 10k and smaller than
1723217232
4g. By default "tune.quic.frontend.default-max-window-size" value is used.
17233-
- count of datagrams to emit in a burst if pacing is activated. It must be
17234-
between the default value of 1 and 1024.
17233+
- burst size in bytes. By default, it is set to 0, which means unlimited. A
17234+
positive value up to 1024 can be specified to smooth emission with pacing.
17235+
See above paragraph for more explanation.
1723517236

1723617237
Example:
1723717238
# newreno congestion control algorithm
1723817239
quic-cc-algo newreno
1723917240
# cubic congestion control algorithm with one megabytes as window
1724017241
quic-cc-algo cubic(1m)
1724117242
# cubic with pacing on top of it, with burst limited to 12 datagrams
17242-
quic-cc-algo cubic-pacing(,12)
17243+
quic-cc-algo cubic(,12)
1724317244

1724417245
A special value "nocc" may be used to force a fixed congestion window always
1724517246
set at the maximum size. It is reserved for debugging scenarios to remove any

src/cfgparse-quic.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ static unsigned long parse_window_size(const char *kw, char *value,
7272

7373
/* Parse <value> as a number of datagrams allowed for burst.
7474
*
75-
* Returns the parsed value or 0 on error.
75+
* Returns the parsed value or a negative error code.
7676
*/
77-
static uint parse_burst(const char *kw, char *value, char **end_opt, char **err)
77+
static int parse_burst(const char *kw, char *value, char **end_opt, char **err)
7878
{
79-
uint burst;
79+
int burst;
8080

8181
errno = 0;
8282
burst = strtoul(value, end_opt, 0);
@@ -85,23 +85,22 @@ static uint parse_burst(const char *kw, char *value, char **end_opt, char **err)
8585
goto fail;
8686
}
8787

88-
if (!burst || burst > 1024) {
89-
memprintf(err, "'%s' : pacing burst value must be between 1 and 1024", kw);
88+
if (burst < 0 || burst > 1024) {
89+
memprintf(err, "'%s' : pacing burst value must be between 0 and 1024", kw);
9090
goto fail;
9191
}
9292

9393
return burst;
9494

9595
fail:
96-
return 0;
96+
return -1;
9797
}
9898

9999
/* parse "quic-cc-algo" bind keyword */
100100
static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
101101
struct bind_conf *conf, char **err)
102102
{
103103
struct quic_cc_algo *cc_algo = NULL;
104-
const char *str_pacing = "-pacing";
105104
const char *algo = NULL;
106105
char *arg;
107106

@@ -128,19 +127,6 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
128127
algo = QUIC_CC_CUBIC_STR;
129128
*cc_algo = quic_cc_algo_cubic;
130129
arg += strlen(QUIC_CC_CUBIC_STR);
131-
132-
if (strncmp(arg, str_pacing, strlen(str_pacing)) == 0) {
133-
if (!experimental_directives_allowed) {
134-
memprintf(err, "'%s' : support for pacing is experimental, must be allowed via a global "
135-
"'expose-experimental-directives'\n", args[cur_arg]);
136-
goto fail;
137-
}
138-
139-
cc_algo->pacing_rate = quic_cc_default_pacing_rate;
140-
cc_algo->pacing_burst = quic_cc_default_pacing_burst;
141-
conf->quic_pacing_burst = 1;
142-
arg += strlen(str_pacing);
143-
}
144130
}
145131
else if (strncmp(arg, QUIC_CC_BBR_STR, strlen(QUIC_CC_BBR_STR)) == 0) {
146132
if (!experimental_directives_allowed) {
@@ -198,11 +184,25 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
198184
goto out;
199185

200186
if (*arg != ',') {
201-
uint burst = parse_burst(args[cur_arg], arg, &end_opt, err);
202-
if (!burst)
187+
int burst = parse_burst(args[cur_arg], arg, &end_opt, err);
188+
if (burst < 0)
203189
goto fail;
204190

205-
conf->quic_pacing_burst = burst;
191+
if (burst && cc_algo->type == QUIC_CC_ALGO_TP_CUBIC) {
192+
if (!experimental_directives_allowed) {
193+
memprintf(err, "'%s' : support for pacing is experimental, must be allowed via a global "
194+
"'expose-experimental-directives'\n", args[cur_arg]);
195+
goto fail;
196+
}
197+
198+
conf->quic_pacing_burst = burst;
199+
cc_algo->pacing_rate = quic_cc_default_pacing_rate;
200+
cc_algo->pacing_burst = quic_cc_default_pacing_burst;
201+
}
202+
else {
203+
ha_warning("'%s' : burst parameter ignored for '%s' congestion algorithm\n",
204+
args[cur_arg], algo);
205+
}
206206

207207
if (*end_opt == ')') {
208208
goto out;

0 commit comments

Comments
 (0)