Repaso
Español
Backend & APIsAdvancedAPI-21

Which rate limiting algorithm naturally allows short bursts while enforcing an average rate?

Options

  1. Fixed window counter
  2. Token bucket (Correct option)
  3. Round robin
  4. FIFO queue

Answer

Token bucket

Why

Picture a bucket that receives tokens at a fixed rate (e.g. 10 per second) up to a maximum (e.g. 50). Each request takes one token; no token, request rejected.

If a client was quiet, the bucket fills up, so it can send a short burst of 50 at once; over time it can never exceed 10 per second.

Fixed windows are simpler but allow double bursts at window edges.

Remember

Token bucket = steady average + allowed bursts.

Key terms

Practice this question in Repaso