pub struct PeakEWMA {
pub decay: f64,
pub rtt: f64,
pub last_event: Instant,
}Expand description
exponentially weighted moving average with high sensibility to latency bursts
It reads no clock: construction, Self::observe and Self::get each
take the instant they happen at, so the decay a simulator observes is a
function of the instants it supplies (#1684).
cf Finagle for the original implementation: https://github.com/twitter/finagle/blob/9cc08d15216497bb03a1cafda96b7266cfbbcff1/finagle-core/src/main/scala/com/twitter/finagle/loadbalancer/PeakEwma.scala
Fields§
§decay: f64decay in nanoseconds
higher values will make the EWMA decay slowly to 0
rtt: f64estimated RTT in nanoseconds
must be set to a high enough default value so that new backends do not get all the traffic right away
last_event: Instantlast modification
Implementations§
Source§impl PeakEWMA
impl PeakEWMA
Sourcepub fn new(now: Instant) -> Self
pub fn new(now: Instant) -> Self
A fresh average created at now, which the first decay is measured
from. Hardcoded default values for now.