Skip to content
StackDecode
System Design
10. API Design and ManagementAnimated

API Throttling

Slowing down requests instead of rejecting.

The idea

Throttling delays or queues excess requests to protect capacity.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

arrivals 4bucket 4allowed 4 rejected 0steady rate
  • allowed
  • rejected

4 requests arrive. The bucket drains at a steady 3 per tick, and anything that overflows is dropped. Output stays smooth.

tick:
1
allowed:
4
rejected:
0
1/24

Bars show how many requests were let through each tick.

Step by step

  1. 1Detect high rate
  2. 2Delay or queue extra requests
  3. 3Serve at a steady pace
  4. 4Reject if the queue is full

Where it is used

Protecting backends.

Watch out for

Queued requests still consume memory and time.

Related