Class AdaptiveConcurrencyLimitOptions

Namespace
Kevlar
Assembly
Kevlar.dll

Configures a concurrency limit that responds to downstream latency and failures.

public sealed class AdaptiveConcurrencyLimitOptions
Inheritance
AdaptiveConcurrencyLimitOptions
Inherited Members

Remarks

Completed calls are sampled using the shield's TimeProvider. Excess callers are rejected immediately; this strategy has no wait queue. Caller cancellation is excluded from samples. Place a timeout inside this strategy to observe its timeout outcome as a failure.

Constructors

AdaptiveConcurrencyLimitOptions()

public AdaptiveConcurrencyLimitOptions()

Properties

Algorithm

The adjustment algorithm. Default Aimd.

public AdaptiveConcurrencyLimitAlgorithm Algorithm { get; set; }

Property Value

AdaptiveConcurrencyLimitAlgorithm

DecreaseFactor

The multiplier applied to a congested limit, greater than zero and less than one. Default 0.9.

public double DecreaseFactor { get; set; }

Property Value

double

InitialLimit

The starting limit, between MinLimit and MaxLimit. Default 10.

public int InitialLimit { get; set; }

Property Value

int

LatencyTolerance

The successful mean latency multiplier above which a window is congested. Default 2.

public double LatencyTolerance { get; set; }

Property Value

double

Remarks

Must be at least one. The reference latency starts with the first successful window and then uses a moving average with 10% weight for each subsequent successful window.

MaxLimit

The maximum limit, which must be at least MinLimit. Default 100.

public int MaxLimit { get; set; }

Property Value

int

MinLimit

The minimum limit, which must be positive. Default 1.

public int MinLimit { get; set; }

Property Value

int

Name

An optional low-cardinality name used by strategy telemetry.

public string? Name { get; set; }

Property Value

string

OnRejected

Invoked and awaited when admission is rejected. Callback failures do not replace the rejection.

public Func<ConcurrencyLimitRejectedEvent, ValueTask>? OnRejected { get; set; }

Property Value

Func<ConcurrencyLimitRejectedEvent, ValueTask>

SamplingWindow

The minimum interval between adjustments, evaluated on completion. Default one second.

public TimeSpan SamplingWindow { get; set; }

Property Value

TimeSpan