[][src]Struct tower::load::peak_ewma::PeakEwma

pub struct PeakEwma<S, C = CompleteOnResponse> { /* fields omitted */ }
This is supported on crate feature load only.

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>[src]

pub fn new(
    service: S,
    default_rtt: Duration,
    decay_ns: f64,
    completion: C
) -> Self
[src]

Wraps an S-typed service so that its load is tracked by the EWMA of its peak latency.

Trait Implementations

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

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

type Metric = Cost

A comparable load metric. Read more

impl<S, C, Request> Service<Request> for PeakEwma<S, C> where
    S: Service<Request>,
    C: TrackCompletion<Handle, S::Response>, 
[src]

type Response = C::Output

Responses given by the service.

type Error = S::Error

Errors produced by the service.

type Future = TrackCompletionFuture<S::Future, C, Handle>

The future response value.

Auto Trait Implementations

impl<S, C> RefUnwindSafe for PeakEwma<S, C> where
    C: RefUnwindSafe,
    S: RefUnwindSafe
[src]

impl<S, C> Send for PeakEwma<S, C> where
    C: Send,
    S: Send
[src]

impl<S, C> Sync for PeakEwma<S, C> where
    C: Sync,
    S: Sync
[src]

impl<S, C> Unpin for PeakEwma<S, C> where
    C: Unpin,
    S: Unpin
[src]

impl<S, C> UnwindSafe for PeakEwma<S, C> where
    C: UnwindSafe,
    S: UnwindSafe
[src]

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Request> ServiceExt<Request> for T where
    T: Service<Request> + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,