---
library: "bootstrap"
slug: "Throttle"
name: "Throttle"
ref: "Throttle#dd62"
hash: "sema:Throttle#mh:SHA-256:dd626ad2479e5377339f44e77b61a0264591ed21a906556f020fccb98450fe55"
type: "Primitives"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/Throttle"
---

# Throttle

Rate-limiting to prevent resource exhaustion

Infrastructure · Primitives

## Mechanism

Rate Limiting: Maximum N [Task](https://semahash.org/vocabularies/bootstrap/patterns/Task.md)s 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](https://semahash.org/vocabularies/bootstrap/patterns/Backoff.md).

## 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

- [Backoff](https://semahash.org/vocabularies/bootstrap/patterns/Backoff.md) (composes_with)
- [Task](https://semahash.org/vocabularies/bootstrap/patterns/Task.md) (accepts)

## Used by

- [Cooldown](https://semahash.org/vocabularies/bootstrap/patterns/Cooldown.md) (references)
- [Warmup](https://semahash.org/vocabularies/bootstrap/patterns/Warmup.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: Throttle#dd62
- Hash: sema:Throttle#mh:SHA-256:dd626ad2479e5377339f44e77b61a0264591ed21a906556f020fccb98450fe55

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/Throttle
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/Throttle.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
