Skip to main content

Module http_limits

Module http_limits 

Source
Expand description

Resolution of the three HTTP handler-pool knobs (issue #574 slice 5).

The values are configurable through the standard precedence chain used elsewhere in the boot path:

flag > red_config > env > built-in default

Built-in defaults reproduce the hard-coded values from slices 1+2:

  • max_handlers = (2 * num_cpus).clamp(8, 256)
  • handler_timeout = 30_000 ms
  • retry_after_secs = 5

Each knob is validated at parse time and at resolution time so a stale red_config value cannot corrupt the running server.

Structs§

HttpLimitsCliInput
CLI-layer input. Each pair holds the already-validated value coming from a flag and from an env var, respectively. The resolver applies the flag > red_config > env > default precedence using these inputs plus a config-store lookup.
HttpLimitsResolved
Resolved values after applying the full precedence chain. Stamped into both the RedDBServer and the startup log line.

Constants§

DEFAULT_HANDLER_TIMEOUT_MS
DEFAULT_RETRY_AFTER_SECS
MAX_RETRY_AFTER_SECS
MIN_HANDLER_TIMEOUT_MS
Lower bound for handler_timeout_ms. Anything below this is so short the deadline trips on healthy requests; we reject the value.
MIN_RETRY_AFTER_SECS
Inclusive bounds for retry_after_secs. Below 1s means clients hammer the server; above 30s means a transient overload looks like a permanent outage to load balancers.

Functions§

default_max_handlers
Built-in default for max_handlers. Matches HttpConnectionLimiter::with_default_cap.
resolve_http_limits
Apply the flag > red_config > env > default chain.
validate_handler_timeout_ms
validate_max_handlers
Validate a max_handlers candidate from any source. Returns the value unchanged on success.
validate_retry_after_secs