AdaptiveQueryLimit

class AdaptiveQueryLimit(val bulkhead: QueryBulkhead, pressure: WritePressure, val options: AdaptiveLimitOptions = AdaptiveLimitOptions.DEFAULT)

The bulkhead's limit, adapted to its store's write pressure (the writes come first), by additive increase and multiplicative decrease, one evaluate per period. The queries contend in a period when the limit held one back (it waited or was refused), or when it ends with queries waiting or running at the limit.

  • AdaptiveLimitOptions.periods pressing periods in a row in which the queries contend: the limit halves, down to the floor, and the count starts over, so the next halving waits as long. A pressing period in which they do not contend leaves the limit as it is and starts the count over: lowering a limit the queries do not reach would relieve no write, and would hold back the next queries for writes that did not wait on them.

  • A period that does not press: the limit rises by one, up to the bulkhead's ceiling when the queries contend, else up to the limit the bulkhead started with. So a limit lowered under load climbs back once the writes are calm, whether queries come or not; only a demand that the limit holds back takes it above its start, toward the ceiling, which is room for that demand rather than where an idle store rests.

  • Otherwise it stays.

Lowering the limit cancels no running query (see QueryBulkhead.limit).

Constructors

Link copied to clipboard
constructor(bulkhead: QueryBulkhead, pressure: WritePressure, options: AdaptiveLimitOptions = AdaptiveLimitOptions.DEFAULT)

Properties

Link copied to clipboard
Link copied to clipboard

How many times the limit was lowered.

Link copied to clipboard
val floor: Int

The lowest limit: the floor, or the ceiling when that is lower.

Link copied to clipboard

The last period's sample of the write pressure.

Link copied to clipboard
Link copied to clipboard

Whether the last period pressed.

Functions

Link copied to clipboard

Ends one period: reads the pressure and the bulkhead's contention, and moves the limit.

Link copied to clipboard
open override fun toString(): String