{
 "library": "bootstrap",
 "version": "0.11.0",
 "root": "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5",
 "license": null,
 "slug": "Throttle",
 "ref": "Throttle#dd62",
 "hash": "sema:Throttle#mh:SHA-256:dd626ad2479e5377339f44e77b61a0264591ed21a906556f020fccb98450fe55",
 "stub": "dd62",
 "layer": "Infrastructure",
 "type": "Primitives",
 "summary": "Rate-limiting to prevent resource exhaustion",
 "mechanism": "Rate Limiting: Maximum N Task#a850s 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#9e59.",
 "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": [
  {
   "name": "rate_limit",
   "type": "Integer",
   "range": "[1, 10000]",
   "description": "Max requests per window"
  },
  {
   "name": "window",
   "type": "Duration",
   "range": "[1s, 1h]",
   "description": "Time window for rate calculation"
  },
  {
   "name": "burst_size",
   "type": "Integer",
   "range": "[1, 100]",
   "description": "Temporary overflow allowance"
  },
  {
   "name": "excess_policy",
   "type": "Enum",
   "range": "{reject, queue, delay}",
   "description": "What happens above the limit. Named in the intersection and previously expressible nowhere."
  }
 ],
 "signature": [],
 "preconditions": [
  "Token bucket or Leaky bucket state initialized"
 ],
 "postconditions": [],
 "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."
 ],
 "domain": "",
 "caution": "",
 "sources": [],
 "name": "Throttle",
 "builds_on": [
  {
   "alias": "backoff",
   "relation": "composes_with",
   "library": "bootstrap",
   "slug": "Backoff",
   "ref": "Backoff#9e59",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Backoff"
  },
  {
   "alias": "task",
   "relation": "accepts",
   "library": "bootstrap",
   "slug": "Task",
   "ref": "Task#a850",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Task"
  }
 ],
 "related": [],
 "used_by": [
  {
   "slug": "Cooldown",
   "relation": "references",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Cooldown"
  },
  {
   "slug": "Warmup",
   "relation": "references",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Warmup"
  }
 ],
 "url": "https://semahash.org/vocabularies/bootstrap/patterns/Throttle",
 "md_url": "https://semahash.org/vocabularies/bootstrap/patterns/Throttle.md",
 "library_url": "https://semahash.org/vocabularies/bootstrap"
}
