Struct tower_load::peak_ewma::PeakEwma [−][src]
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..
Note
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.
fn load(&self) -> Self::Metric
[src]
impl<S, I, Request> Service<Request> for PeakEwma<S, I> where
S: Service<Request>,
I: Instrument<Handle, S::Response>,
[src]
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.
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
[src]
fn call(&mut self, req: Request) -> Self::Future
[src]
Auto Trait Implementations
impl<S, I> RefUnwindSafe for PeakEwma<S, I> where
I: RefUnwindSafe,
S: RefUnwindSafe,
I: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, I> Send for PeakEwma<S, I> where
I: Send,
S: Send,
I: Send,
S: Send,
impl<S, I> Sync for PeakEwma<S, I> where
I: Sync,
S: Sync,
I: Sync,
S: Sync,
impl<S, I> Unpin for PeakEwma<S, I> where
I: Unpin,
S: Unpin,
I: Unpin,
S: Unpin,
impl<S, I> UnwindSafe for PeakEwma<S, I> where
I: UnwindSafe,
S: UnwindSafe,
I: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,