Library
7 min read

Rate limiting vs throttling vs backpressure

Every system has a speed it can work at. When work arrives faster than that, something has to give. The only question is what, and these four words are four different answers:

  • Rate limiting: refuse anything over an agreed rate. "This API key gets 100 requests a second; the 101st gets 429 Too Many Requests." The bouncer at a full club.
  • Throttling: slow the caller down instead of refusing. Requests over the rate wait and are served later. The toll plaza that lets cars through one at a time.
  • Backpressure: the overloaded component signals upstream to send less, and the slowdown travels back towards the source. A full kitchen tells the waiters to stop taking orders.
  • Load shedding: when overloaded anyway, deliberately drop some work, the least important first, so the rest still succeeds.

People use "rate limiting" and "throttling" loosely and sometimes interchangeably (AWS calls its 429 style rejections "throttling"). In a design discussion, be precise about whether the excess is rejected, delayed or pushed back.

Your answer

A worker processes 100 orders a second. A flash sale sends 160 a second for ten minutes, into an in memory queue with no size limit. Walk through what happens minute by minute. What would you change?

Watch overload play out#

A worker that handles 100 requests a second
160
OOM5000s30s60s
Waiting at 60 s: crashedRejected: 0Wait for a new request: n/a
60 extra requests a second pile up in an unbounded queue. Latency climbs with it, and at 51 s the process runs out of memory and drops everything, including work it had accepted. This is the most common way overload turns into an outage.

The unbounded queue is the instructive failure. Nothing errors at first. The queue just grows, latency grows with it, clients time out and retry (adding even more load), memory climbs, and then the process dies and loses everything it had accepted. An overloaded system without limits does not degrade gracefully, it falls off a cliff.