MINOR: quic: use stream elasticity value for initial advertisement

When stream elasticity is active, the maximum number of concurrent bidi
streams advertised via transport parameters is now reduced depending on
the connection load. This is implemented via conn_calc_max_streams()
which returns the value to use.

This is not applied on listeners with enabled 0-RTT. Indeed, for such
connections, clients are expected to reuse the previously seen transport
parameters. The server on the other hand must not decrease several
values on the newly advertised params, in particular for the maximum
number of concurrent bidi streams. The simplest way to prevent 0-RTT
failure is to not mix stream elasticity with it.

Note that the 0-RTT limitation is only applied for the initial value :
during the connection lifetime, stream elasticity can still be used by
the MUX to dynamically reduce the stream window. This will be
implemented in a future patch.
This commit is contained in:
Amaury Denoyelle 2026-05-18 08:27:32 +02:00
parent e4adba6e64
commit d21ec4c707
3 changed files with 21 additions and 0 deletions

View file

@ -5727,6 +5727,10 @@ tune.streams-elasticity <number>
use lower values (120 to 200) to support 1.2 to 2 streams per connection on
average at full load.
There is a limitation for QUIC listeners with enabled 0-RTT. In this case,
the initial value advertised to the peer will ignore stream elasticity and
instead rely solely on the "tune.quic.stream.max-concurrent" setting.
Monitoring the total number of active streams on backends, including queues,
provides a practical indicator of a sustainable target load and helps avoid
over-provisioning.

View file

@ -1808,6 +1808,13 @@ int proxy_finalize(struct proxy *px, int *err_code)
proxy_type_str(px), px->id);
*err_code |= ERR_WARN;
}
if (bind_conf->ssl_conf.early_data && conn_calc_max_streams(1)) {
ha_notice("Binding [%s:%d] for %s %s: "
"stream elasticity is ignored for initial connection settings as this is incompatible with 0-RTT.",
bind_conf->file, bind_conf->line,
proxy_type_str(px), px->id);
}
}
#endif /* USE_QUIC */

View file

@ -1,6 +1,7 @@
#include <arpa/inet.h>
#include <string.h>
#include <haproxy/connection.h>
#include <haproxy/global.h>
#include <haproxy/ncbuf-t.h>
#include <haproxy/net_helper.h>
@ -862,6 +863,15 @@ int qc_lstnr_params_init(struct quic_conn *qc,
rx_params->initial_source_connection_id.len = scidlen;
TRACE_PROTO("\nRX(local) transp. params.", QUIC_EV_TRANSP_PARAMS, qc, rx_params);
/* Reduce max-streams-bidi if stream elasticity is active. This is
* ignored however if 0-RTT is configured as clients could reuse
* different transport parameters than the one advertised.
*/
if (global.tune.streams_elasticity && !qc->li->bind_conf->ssl_conf.early_data) {
rx_params->initial_max_streams_bidi =
conn_calc_max_streams(rx_params->initial_max_streams_bidi);
}
return 1;
}