gradient2
gradient2(
options?):LimitAlgorithm
Defined in: src/adaptive-concurrency.ts:101
Gradient: compares short-term latency to a long-term baseline. gradient = tolerance * baseline / short, clamped to [0.5, 1]:
1 while latency is within tolerance (grow by queueSize), below 1 when latency climbs (shrink in proportion). The new estimate is
smoothed into the old one so one slow call does not swing the limit.
Differs from a plain long-term EMA on purpose: under sustained overload a plain EMA drifts up to the overloaded latency, which then
looks normal and the limit creeps up without bound. Here the baseline drops to any lower short-term latency at once, and rises
(slowly, over longWindow samples) only while latency is within tolerance.
Parameters
Section titled “Parameters”options?
Section titled “options?”Gradient2Options = {}