Infrastructure · Primitives
Throttle
Rate-limiting to prevent resource exhaustion
Definition
Mechanism
Rate Limiting: Maximum N Tasks per time window W. Excess requests rejected, queued, or delayed. Window can be sliding or fixed. Separate limits per action type or global. Utilizes Backoff.
Preconditions
- Token bucket or Leaky bucket state initialized
Invariants
- Rate limit: output rate ≤ `rate_limit` within any `window`, sliding or fixed.
- Excess is handled by the declared `excess_policy` — rejected, queued, or delayed. Only rejection drops.
Risks
Failure modes
Unbounded queue
`excess_policy` is queue or delay and arrivals stay above the limit, so latency grows without anything being dropped or refused.
Relationships
Builds on
Accepts
The atomic unit of intent
Composes with
Delay subsequent attempts after failure or contention
Used by
Reference
Parameters
rate_limitInteger, [1, 10000]- Max requests per window
windowDuration, [1s, 1h]- Time window for rate calculation
burst_sizeInteger, [1, 100]- Temporary overflow allowance
excess_policyEnum, {reject, queue, delay}- What happens above the limit. Named in the intersection and previously expressible nowhere.
