Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_int-rate-limiter

Distributed Rate Limiter Internals (Atomic Lua Token Bucket & Sliding Window)

7 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Distributed Rate Limiter Internals (Atomic Lua Token Bucket & Sliding Window) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_int-rate-limiter/opengraph-image)](https://archos.sageideas.dev/d/dgm_int-rate-limiter)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_int-rate-limiter)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_int-rate-limiter" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Distributed Rate Limiter Internals (Atomic Lua Token Bucket & Sliding Window) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["API Consumer"]
  gw_1["API Gateway PEP"]
  loc_2[("Local Token Cache")]
  red_3[("Redis Lua Engine")]
  cfg_4[("Quota Config Store")]
  up_5["Protected Backend"]
  downstream_6["Downstream & OTel"]
  client_0 -->|"1. HTTP · HTTPS"| gw_1
  gw_1 -->|"2a. Check · RAM"| loc_2
  gw_1 -->|"2b. EVALSHA · RESP3"| red_3
  cfg_4 -->|"Sync tier · PubSub"| gw_1
  gw_1 -->|"2c. Forward if · HTTP/2"| up_5
  red_3 -.->|"3. Emit / · OTLP/API"| downstream_6

COMPONENT STACK (7)

  • API ConsumerSTATELESS
    Tenant Key / IP
  • API Gateway PEPSTATELESS
    Extracts tenant_id + route key
  • Local Token CacheSTATEFUL
    In-proc burst + fallback guard
  • Redis Lua EngineSTATEFUL
    Atomic Token Bucket / GCRA
  • Quota Config StoreSTATEFUL
    Per-tier limits pushed via pubsub
  • Protected BackendSTATELESS
    200 OK or 429 + Retry-After
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. API Consumer → API Gateway PEP (HTTP)[HTTPS]
  2. API Gateway PEP → Local Token Cache (Check)[RAM]
  3. API Gateway PEP → Redis Lua Engine (EVALSHA)[RESP3]
  4. Quota Config Store → API Gateway PEP (Sync tier)[PubSub]
  5. API Gateway PEP → Protected Backend (Forward if)[HTTP/2]
  6. Redis Lua Engine → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →