pub struct PeakEwma<S, C = CompleteOnResponse> { /* private fields */ }
Expand description
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
Trait Implementations
sourceimpl<S, C, Request> Service<Request> for PeakEwma<S, C>where
S: Service<Request>,
C: TrackCompletion<Handle, S::Response>,
impl<S, C, Request> Service<Request> for PeakEwma<S, C>where
S: Service<Request>,
C: TrackCompletion<Handle, S::Response>,
type Response = <C as TrackCompletion<Handle, <S as Service<Request>>::Response>>::Output
type Response = <C as TrackCompletion<Handle, <S as Service<Request>>::Response>>::Output
type Future = TrackCompletionFuture<<S as Service<Request>>::Future, C, Handle>
type Future = TrackCompletionFuture<<S as Service<Request>>::Future, C, Handle>
Auto Trait Implementations
impl<S, C> RefUnwindSafe for PeakEwma<S, C>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, C> Send for PeakEwma<S, C>where
C: Send,
S: Send,
impl<S, C> Sync for PeakEwma<S, C>where
C: Sync,
S: Sync,
impl<S, C> Unpin for PeakEwma<S, C>where
C: Unpin,
S: Unpin,
impl<S, C> UnwindSafe for PeakEwma<S, C>where
C: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
sourcefn ready(&mut self) -> Ready<'_, Self, Request>ⓘNotable traits for Ready<'a, T, Request>impl<'a, T, Request> Future for Ready<'a, T, Request>where
T: Service<Request>, type Output = Result<&'a mut T, T::Error>;
where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>ⓘNotable traits for Ready<'a, T, Request>impl<'a, T, Request> Future for Ready<'a, T, Request>where
T: Service<Request>, type Output = Result<&'a mut T, T::Error>;
where
Self: Sized,
T: Service<Request>, type Output = Result<&'a mut T, T::Error>;
sourcefn ready_and(&mut self) -> ReadyAnd<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> ReadyAnd<'_, Self, Request>where
Self: Sized,
ServiceExt::ready
method insteadsourcefn ready_oneshot(self) -> ReadyOneshot<Self, Request>ⓘNotable traits for ReadyOneshot<T, Request>impl<T, Request> Future for ReadyOneshot<T, Request>where
T: Service<Request>, type Output = Result<T, T::Error>;
where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>ⓘNotable traits for ReadyOneshot<T, Request>impl<T, Request> Future for ReadyOneshot<T, Request>where
T: Service<Request>, type Output = Result<T, T::Error>;
where
Self: Sized,
T: Service<Request>, type Output = Result<T, T::Error>;
sourcefn oneshot(self, req: Request) -> Oneshot<Self, Request>ⓘNotable traits for Oneshot<S, Req>impl<S, Req> Future for Oneshot<S, Req>where
S: Service<Req>, type Output = Result<S::Response, S::Error>;
where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>ⓘNotable traits for Oneshot<S, Req>impl<S, Req> Future for Oneshot<S, Req>where
S: Service<Req>, type Output = Result<S::Response, S::Error>;
where
Self: Sized,
S: Service<Req>, type Output = Result<S::Response, S::Error>;
Service
, calling with the providing request once it is ready.sourcefn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<BoxError>,
S: Stream<Item = Request>,
fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<BoxError>,
S: Stream<Item = Request>,
sourcefn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
poll_ready
method. Read moresourcefn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
poll_ready
method. Read moresourcefn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
poll_ready
method. Read moresourcefn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read more