private static double ComputeRejectionProbability(CounterMetrics metrics, AdaptiveThrottlingOptions options) { var probability = 1.0 * (metrics.Requests - options.CriticalRatio * metrics.Accepts) / (metrics.Requests + 1); probability = Math.Max(probability, 0.0); probability = Math.Min(probability, options.MaximumRejectProbability); return(probability); }
public AdaptiveThrottlingModule(AdaptiveThrottlingOptions options) { this.options = options; counterFactory = _ => new Counter(options.MinutesToTrack); }