pub struct PeakEwma<S, I = NoInstrument> { /* private fields */ }
Expand description
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.