Carriers Auto-negotiation Aggressiveness

Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
Alexey
2026-08-26 18:33:56 +03:00
parent 923c79796a
commit f180057973
10 changed files with 260 additions and 80 deletions
+10
View File
@@ -264,6 +264,7 @@ const WEB_CONFIG_KEYS: &[&str] = &[
"carrier",
"carriers",
"carrier_learning",
"carrier_negotiation_aggressiveness",
"debug",
"limits",
"timeouts",
@@ -278,10 +279,14 @@ const WEB_LIMITS_CONFIG_KEYS: &[&str] = &[
"max_frames_per_body",
"max_http_connections",
"max_http_handlers",
"max_lane_open_waits_per_session",
"pending_bytes_per_lane",
"pending_items_per_lane",
"websocket_bytes_global",
"websocket_admission_watermark_pct",
"websocket_eviction_watermark_pct",
"websocket_http_connection_reserve",
"max_websocket_evictions_in_flight",
"max_carrier_learning_entries",
"max_body_readers",
"max_body_bytes_global",
@@ -332,7 +337,12 @@ const WEB_TIMEOUTS_CONFIG_KEYS: &[&str] = &[
"header_secs",
"body_secs",
"stream_handshake_secs",
"stream_first_byte_secs",
"long_poll_secs",
"lane_open_wait_secs",
"carrier_health_secs",
"websocket_upgrade_secs",
"websocket_open_secs",
"websocket_write_secs",
"websocket_backpressure_secs",
"websocket_eviction_secs",
+14 -2
View File
@@ -72,9 +72,9 @@ pub(super) fn validate(config: &mut ProxyConfig) -> Result<()> {
validate_limits(&config.web.limits)?;
debug::validate(&config.web.debug, &config.web.limits)?;
let carriers = negotiation::validate(&config.web)?;
if carriers.contains(&WebCarrier::HttpsLanes) && config.web.limits.max_http_handlers < 2 {
if carriers.contains(&WebCarrier::HttpsLanes) && config.web.limits.max_http_handlers < 4 {
return config_error(
"WEB https-lanes candidates require web.limits.max_http_handlers >= 2",
"WEB https-lanes candidates require web.limits.max_http_handlers >= 4",
);
}
timeouts::validate(&config.web.timeouts)?;
@@ -162,6 +162,16 @@ fn validate_limits(limits: &WebLimitsConfig) -> Result<()> {
let positive = [
("max_http_connections", limits.max_http_connections),
("max_http_handlers", limits.max_http_handlers),
(
"max_lane_open_waits_per_session",
limits.max_lane_open_waits_per_session,
),
("pending_bytes_per_lane", limits.pending_bytes_per_lane),
("pending_items_per_lane", limits.pending_items_per_lane),
(
"max_websocket_evictions_in_flight",
limits.max_websocket_evictions_in_flight,
),
(
"max_carrier_learning_entries",
limits.max_carrier_learning_entries,
@@ -240,6 +250,8 @@ fn validate_limits(limits: &WebLimitsConfig) -> Result<()> {
|| limits.max_body_readers > limits.max_http_handlers
|| limits.pending_bytes_per_session > limits.pending_bytes_global
|| limits.pending_items_per_session > limits.pending_items_global
|| limits.pending_bytes_per_lane > limits.pending_bytes_per_session
|| limits.pending_items_per_lane > limits.pending_items_per_session
|| limits.control_bytes_per_session > limits.control_bytes_global
|| limits.control_bytes_per_session > limits.pending_bytes_per_session
|| limits.control_bytes_global > limits.pending_bytes_global
@@ -14,6 +14,14 @@ pub(super) fn validate(config: &WebConfig) -> Result<Vec<WebCarrier>> {
}
}
let candidates = config.carrier_candidates();
if config.carrier_negotiation_enabled()
&& config.carrier_learning
&& config.limits.max_carrier_learning_entries < 3
{
return config_error(
"web.limits.max_carrier_learning_entries must be >= 3 when carrier learning is enabled",
);
}
if candidates.len() > WebCarrier::ALL.len() {
return config_error(
"web.carriers and the web.carrier fallback must contain at most four carriers",
+5
View File
@@ -6,7 +6,12 @@ pub(super) fn validate(timeouts: &WebTimeoutsConfig) -> Result<()> {
("header_secs", timeouts.header_secs),
("body_secs", timeouts.body_secs),
("stream_handshake_secs", timeouts.stream_handshake_secs),
("stream_first_byte_secs", timeouts.stream_first_byte_secs),
("long_poll_secs", timeouts.long_poll_secs),
("lane_open_wait_secs", timeouts.lane_open_wait_secs),
("carrier_health_secs", timeouts.carrier_health_secs),
("websocket_upgrade_secs", timeouts.websocket_upgrade_secs),
("websocket_open_secs", timeouts.websocket_open_secs),
("websocket_write_secs", timeouts.websocket_write_secs),
(
"websocket_backpressure_secs",