Struct PeakEwma
struct PeakEwma<S, C = super::completion::CompleteOnResponse> { ... }
Measures the load of the underlying service using Peak-EWMA load measurement.
PeakEwma implements Load with the Cost metric that estimates the amount of
pending work to an endpoint. Work is calculated by multiplying the
exponentially-weighted moving average (EWMA) of response latencies by the number of
pending requests. The Peak-EWMA algorithm is designed to be especially sensitive to
worst-case latencies. Over time, the peak latency value decays towards the moving
average of latencies to the endpoint.
When no latency information has been measured for an endpoint, an arbitrary default RTT of 1 second is used to prevent the endpoint from being overloaded before a meaningful baseline can be established..
Note
This is derived from Finagle, which is distributed under the Apache V2 license. Copyright 2017, Twitter Inc.
Implementations
impl<S, C> PeakEwma<S, C>
fn new(service: S, default_rtt: Duration, decay_ns: f64, completion: C) -> SelfWraps an
S-typed service so that its load is tracked by the EWMA of its peak latency.
impl<M, S, Target, Request> MakeService for PeakEwma<S, C>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future
impl<S, C> Freeze for PeakEwma<S, C>
impl<S, C> Load for PeakEwma<S, C>
fn load(self: &Self) -> <Self as >::Metric
impl<S, C> RefUnwindSafe for PeakEwma<S, C>
impl<S, C> Send for PeakEwma<S, C>
impl<S, C> Sync for PeakEwma<S, C>
impl<S, C> Unpin for PeakEwma<S, C>
impl<S, C> UnwindSafe for PeakEwma<S, C>
impl<S, C, Request> Service for PeakEwma<S, C>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>fn call(self: &mut Self, req: Request) -> <Self as >::Future
impl<S: $crate::fmt::Debug, C: $crate::fmt::Debug> Debug for PeakEwma<S, C>
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl<T> Any for PeakEwma<S, C>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for PeakEwma<S, C>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for PeakEwma<S, C>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for PeakEwma<S, C>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for PeakEwma<S, C>
impl<T> WithSubscriber for PeakEwma<S, C>
impl<T, Request> ServiceExt for PeakEwma<S, C>
impl<T, U> Into for PeakEwma<S, C>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for PeakEwma<S, C>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for PeakEwma<S, C>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>