[][src]Struct tower_load::peak_ewma::PeakEwma

pub struct PeakEwma<S, I = NoInstrument> { /* fields omitted */ }

Wraps an S-typed Service with 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.

As requests are sent to the underlying service, an I-typed instrumentation strategy is used to track responses to measure latency in an application-specific way. The default strategy measures latency as the elapsed time from the request being issued to the underlying service to the response future being satisfied (or dropped).

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..


This is derived from Finagle, which is distributed under the Apache V2 license. Copyright 2017, Twitter Inc.

Trait Implementations

impl<S: Debug, I: Debug> Debug for PeakEwma<S, I>[src]

impl<S, I> Load for PeakEwma<S, I>[src]

type Metric = Cost

A comparable load metric. Lesser values are "preferable" to greater values.

impl<S, I, Request> Service<Request> for PeakEwma<S, I> where
    S: Service<Request>,
    I: Instrument<Handle, S::Response>, 

type Response = I::Output

Responses given by the service.

type Error = S::Error

Errors produced by the service.

type Future = InstrumentFuture<S::Future, I, Handle>

The future response value.

Auto Trait Implementations

impl<S, I> RefUnwindSafe for PeakEwma<S, I> where
    I: RefUnwindSafe,
    S: RefUnwindSafe

impl<S, I> Send for PeakEwma<S, I> where
    I: Send,
    S: Send

impl<S, I> Sync for PeakEwma<S, I> where
    I: Sync,
    S: Sync

impl<S, I> Unpin for PeakEwma<S, I> where
    I: Unpin,
    S: Unpin

impl<S, I> UnwindSafe for PeakEwma<S, I> where
    I: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.