Throttle
Rate-limiting to prevent resource exhaustion
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.
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.
Parameters
- rate_limit: type=Integer, range=[1, 10000], description=Max requests per window
- window: type=Duration, range=[1s, 1h], description=Time window for rate calculation
- burst_size: type=Integer, range=[1, 100], description=Temporary overflow allowance
- excess_policy: type=Enum, range={reject, queue, delay}, description=What happens above the limit. Named in the intersection and previously expressible nowhere.
Preconditions
- Token bucket or Leaky bucket state initialized
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.
Where this came from
—
Builds on
Used by
Identity
- Ref:
Throttle#dd62 - Hash: sema:Throttle#mh:SHA-256:dd626ad2479e5377339f44e77b61a0264591ed21a906556f020fccb98450fe55
- Library: bootstrap 0.11.0, root a6a3d1ff0f98
- License: Not stated; check the repository