ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Sweep.Pacing

Description

Pacing one sweep cycle inside the target cycle window. Every decision here is a pure function of the last complete cycle's measured request counts and the capacity the store declared.

Synopsis

The window and the capacity a cycle is paced against

defaultCycleWindow :: NominalDiffTime -> NominalDiffTime Source #

The window a cycle is paced to finish inside when the configuration names none: three cycle pauses, so each active cycle is granted the same allowance as the idle interval between them.

nominalPackagePace :: Int -> NominalDiffTime -> Rational Source #

The sweep's own nominal package pace, in requests per second. It is the one dial an operator already has over how hard a cycle leans on a store, so both the derived capacity and the share use it.

derivedCapacity :: Rational -> StoreBudget -> StoreBudget Source #

The capacity a backend that publishes no quota is taken to have: the nominal package pace, on the one request dimension. Raising the chunk pause lowers it, and a declared capacity replaces it.

renderScopeBudget :: SweepPacing -> StoreBudget -> Text Source #

What one store's capacity resolved to, for the boot line: where each figure came from, the share in force, and the per-second ceilings that share yields.

The decision the next cycle runs under

data PaceDecision Source #

What one scope's next cycle runs at, and what it cannot reach inside the window.

Constructors

PaceDecision 

Fields

data BudgetShortfall Source #

Why a cycle cannot be paced inside the window, which the warning names.

decidePace :: SweepPacing -> StoreBudget -> Maybe (RequestTally, Rational) -> PaceDecision Source #

Pace one scope's next cycle from the last complete one: its measured requests, and the seconds that cycle spent outside its own budget waits. With no sample it runs at the ceiling and measures.

renderPaceDecision :: SweepPacing -> PaceDecision -> Maybe Text Source #

The warning an unattainable window earns, naming the budget it would need. The sweep runs on at its ceiling, because a refused cycle leaves the denied version served.