pub struct PoolScaler { /* private fields */ }Expand description
Pool autoscaler that adjusts min_idle based on pressure signals.
Implementations§
Source§impl PoolScaler
impl PoolScaler
Sourcepub fn new(
policy: ScalingPolicy,
initial_min_idle: usize,
max_size: usize,
) -> Self
pub fn new( policy: ScalingPolicy, initial_min_idle: usize, max_size: usize, ) -> Self
Create a new scaler with the given policy and initial min_idle.
Sourcepub fn record_acquire(&mut self, hit: bool)
pub fn record_acquire(&mut self, hit: bool)
Record an acquire event. hit = true if served from pool.
Sourcepub fn current_min_idle(&self) -> usize
pub fn current_min_idle(&self) -> usize
Get the current dynamic min_idle value.
Sourcepub fn update_gateway_pressure(&mut self, pressure: f64)
pub fn update_gateway_pressure(&mut self, pressure: f64)
Update the external Gateway pressure signal.
Pressure is a value from 0.0 (idle) to 1.0 (saturated), derived from Gateway metrics like request rate, queue depth, or latency percentiles.
When Gateway pressure is high, the scaler biases toward scaling up even if the local miss rate is moderate.
Sourcepub fn gateway_pressure(&self) -> f64
pub fn gateway_pressure(&self) -> f64
Get the current Gateway pressure value.
Sourcepub fn evaluate(&mut self) -> ScaleDecision
pub fn evaluate(&mut self) -> ScaleDecision
Evaluate pressure and return a scaling decision.
Respects cooldown period between decisions.
Auto Trait Implementations§
impl Freeze for PoolScaler
impl RefUnwindSafe for PoolScaler
impl Send for PoolScaler
impl Sync for PoolScaler
impl Unpin for PoolScaler
impl UnsafeUnpin for PoolScaler
impl UnwindSafe for PoolScaler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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