Tensorum

Rate Limiting & Admission Control

Protecting the system from more demand than it can serve.

Distributed SystemsBeginner4 hrs4 key ideas · 3 applied designs
0%
your progress

Overview

Protecting the system from more demand than it can serve.

Key ideas

  • Token bucket allows bursts up to bucket size; leaky bucket smooths output.
  • Sliding-window counters approximate exact windows with two buckets and interpolation.
  • Global limits need either a central counter or locally enforced shares that are periodically rebalanced.
  • Virtual waiting rooms and load shedding keep flash-sale spikes from cascading.

Trade-offs

  • Centralised counters are accurate but add a network hop to every request.
  • Local limits are fast but can overshoot the global budget.

In the real world

Envoy / NGINX rate limitingStripe's limiter tiersTicketmaster queues

Keywords

Token bucketSliding windowBackpressure