pub struct PoolConfig {
pub max_idle_connections: Option<usize>,
pub max_idle_connections_per_host: Option<usize>,
pub max_connections: Option<usize>,
pub max_connections_per_host: Option<usize>,
pub max_in_flight_requests: Option<usize>,
pub max_in_flight_requests_per_origin: Option<usize>,
pub idle_timeout: Option<Duration>,
}Expand description
Configuration for the connection pool.
All fields are optional. When a field is None, the corresponding
limit is not applied.
§Logical vs physical limits
max_in_flight_requests / max_in_flight_requests_per_origin (and
their compatibility aliases max_connections /
max_connections_per_host) bound logical in-flight requests
(pool permits, one per request). They do not bound physical TCP
connections: under HTTP/2 one connection carries many multiplexed
streams, under HTTP/3 one QUIC connection carries many streams, and
Hyper owns socket reuse opaquely. Idle-connection caps
(max_idle_connections*, idle_timeout) are physical idle-pool
policy passed to Hyper and are distinct from semaphore concurrency.
Fields§
§max_idle_connections: Option<usize>Maximum number of idle (unused) connections kept per host.
Applied as a per-host cap (the transport has no global idle
limit); see Self::max_connections for a global bound.
This is physical idle-pool policy, not logical concurrency.
max_idle_connections_per_host: Option<usize>Maximum number of idle connections per individual host.
Physical idle-pool policy.
max_connections: Option<usize>Maximum total number of concurrent in-flight requests (logical).
Compatibility alias for Self::max_in_flight_requests kept for
the pre-1.0 release line. Prefer max_in_flight_requests in new
code; when both are set, max_in_flight_requests wins.
max_connections_per_host: Option<usize>Maximum number of concurrent in-flight requests per origin (logical).
Compatibility alias for
Self::max_in_flight_requests_per_origin. Origins are keyed by
(scheme, host, port). Prefer the new name; when both are set,
max_in_flight_requests_per_origin wins.
max_in_flight_requests: Option<usize>Maximum total number of concurrent in-flight requests (logical).
Preferred native name; one permit equals one logical request, not one TCP connection. See the type-level docs for H1/H2/H3 examples.
max_in_flight_requests_per_origin: Option<usize>Maximum number of concurrent in-flight requests per origin (logical).
Preferred native name. Origins are keyed by (scheme, host, port).
idle_timeout: Option<Duration>Duration after which an idle connection is closed.
Physical idle lifetime, not a concurrency bound. When set, every
persistent Hyper client also receives the pool timer Hyper requires
for background idle eviction; Timeout.pool/total are never reused
for this. See HyperClientPolicy and Pool::max_idle_per_host.