Lesson 14 of 15
32. Design a Rate Limiter as a Service

Sources

3 min read+10 XP

Source notes

  • Redis scripting: Lua scripts run atomically; EVALSHA, TIME, hash tags and cluster slots: Redis documentation ("Scripting with Lua", "Redis Cluster specification").
  • Algorithms and headers: see Chapter 25 and its source notes (Cloudflare sliding-window analysis, GitHub limits, RFC 6585, Retry-After).
  • Token-bucket rate limiters in a production API: Stripe engineering blog, "Scaling your API with rate limiters" (2017).
  • All traffic numbers, shard capacities and region demands are interview assumptions agreed in Step 1, not figures for any real service. Arithmetic computed 2026-10-08.
  • Atomic script, race and multi-rule demos, and region rebalancing: tested 2026-10-08 (code/ch32_rate_limiter_service.py, all checks pass).