InterviewForge

Design a Distributed Rate Limiter

A top-notch walkthrough of a distributed rate limiter: token bucket vs sliding window, where to place it, and how to coordinate limits across nodes.

Updated 2026-09Medium

Requirements & scope

  • Functional: limit requests per user/API key to N per second (or minute); return 429 with Retry-After when exceeded.
  • Non-functional: low latency (<1ms added), accurate under concurrency, works across multiple nodes.
  • Scale: millions of keys, each with its own limit; limits must hold globally, not just per node.
  • Consistency: a slight over-limit under a partition is acceptable; a large over-limit is not.

Out of scope (covered in detail below)

Per-tier quotas, billing integration, adaptive/ML-based limiting, and multi-tenant isolation — deferred and discussed in the dedicated section.

Unlock the full guide

Premium members get every DSA, system design, company and role interview guide — plus AI practice, mock interviews, and analytics.

Unlock with Premium