pub struct AdaptiveThreshold { /* private fields */ }Expand description
A threshold that follows the trend it is judging.
§Why it adapts
A fixed threshold cannot work on both a datacentre path and a mobile one: set low enough to detect congestion on a link with microseconds of jitter, it fires constantly on a link with tens of milliseconds of it. Worse, a fixed threshold is what lets a GCC flow be starved by a concurrent loss-based flow — the queue grows past the fixed point, GCC backs off, the other flow takes the space, and GCC never comes back.
So the threshold rises when the trend is outside it and falls when the trend is inside, slowly,
and at different rates: K_u (moving away) is larger than K_d (moving back), so it yields
quickly to a genuine overuse and returns to sensitivity only gradually.
Implementations§
Source§impl AdaptiveThreshold
impl AdaptiveThreshold
Sourcepub fn update(&mut self, now: Instant, estimate_ms: f64) -> f64
pub fn update(&mut self, now: Instant, estimate_ms: f64) -> f64
Move the threshold towards estimate_ms, given how long since the last update.
Returns the updated threshold. now is a parameter rather than read from a clock: upstream
reads time.Now() here, which is why its own threshold tests cannot pin a trajectory.
Sourcepub fn since_update(&self, now: Instant) -> Option<Duration>
pub fn since_update(&self, now: Instant) -> Option<Duration>
How long since this threshold was last updated, if ever.
Trait Implementations§
Source§impl Clone for AdaptiveThreshold
impl Clone for AdaptiveThreshold
Source§fn clone(&self) -> AdaptiveThreshold
fn clone(&self) -> AdaptiveThreshold
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more