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§impl Debug for BackpressureConfig
impl Debug for BackpressureConfig
Source§impl Default for BackpressureConfig
impl Default for BackpressureConfig
Source§impl PartialEq for BackpressureConfig
impl PartialEq for BackpressureConfig
impl StructuralPartialEq for BackpressureConfig
Auto Trait Implementations§
impl Freeze for BackpressureConfig
impl RefUnwindSafe for BackpressureConfig
impl Send for BackpressureConfig
impl Sync for BackpressureConfig
impl Unpin for BackpressureConfig
impl UnsafeUnpin for BackpressureConfig
impl UnwindSafe for BackpressureConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more