pub struct Gradient2 { /* private fields */ }Expand description
Netflix Gradient2–inspired adaptive concurrency limit strategy.
Instead of estimating absolute queue depth (like Vegas), Gradient2 uses the gradient (ratio) of long-term RTT to short-term RTT to detect queueing. A configurable tolerance allows small RTT increases without triggering limit reduction, making it more robust to natural latency variance.
The algorithm maintains two RTT estimates:
- long RTT: exponentially smoothed baseline (adapts slowly)
- short RTT: most recent observed RTT (reacts immediately)
Each update computes:
gradient = clamp(tolerance × long_rtt / short_rtt, 0.5, 1.0)
new_limit = gradient × current_limit + queue_size
limit = smooth(current_limit, new_limit)Implementations§
Trait Implementations§
Source§impl Algorithm for Gradient2
impl Algorithm for Gradient2
Source§fn max_concurrency(&self) -> usize
fn max_concurrency(&self) -> usize
Returns the maximum number of concurrent requests the algorithm currently allows. Read more
Auto Trait Implementations§
impl Freeze for Gradient2
impl RefUnwindSafe for Gradient2
impl Send for Gradient2
impl Sync for Gradient2
impl Unpin for Gradient2
impl UnsafeUnpin for Gradient2
impl UnwindSafe for Gradient2
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
Mutably borrows from an owned value. Read more