pub struct BackpressureConfig {
pub max_concurrent: usize,
pub max_queue: usize,
pub acquire_timeout: Duration,
}Expand description
Backpressure configuration: bound how many backend data operations may be in flight at once, so a slow or failing backend cannot exhaust the caller’s connection pool or memory.
Defaults mirror the Python SDK’s BackpressureConfig
(max_concurrent_requests: 100, queue_size: 1000, timeout: 0.1s).
Over-limit calls first join a bounded waiting queue; a caller that finds
the queue full, or that waits longer than Self::acquire_timeout
without a permit freeing up, is shed with a
crate::error::BackendErrorKind::Backpressure error — never queued
unboundedly. Shed calls do not reach the backend and do not count toward
opening the circuit breaker.
On the #[cachekit] macro’s plain path a shed is outage-class — exactly
like CircuitOpen, the wrapped function runs uncached (fail-open);
secure paths fail closed on a shed like on every other backend error.
Fields§
§max_concurrent: usizeMaximum backend data operations in flight at once (default: 100).
0 behaves as 1; values above tokio’s Semaphore::MAX_PERMITS
(usize::MAX >> 3) are clamped to it, so usize::MAX reads as
“effectively unbounded” rather than panicking the builder.
max_queue: usizeMaximum callers waiting for a permit before further calls are shed
immediately (default: 1000). 0 disables waiting entirely: a call
that cannot take a permit on the spot is shed.
acquire_timeout: DurationHow long a queued caller waits for a permit before it is shed (default: 100 ms).
Trait Implementations§
Source§impl Clone for BackpressureConfig
impl Clone for BackpressureConfig
Source§fn clone(&self) -> BackpressureConfig
fn clone(&self) -> BackpressureConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more