A per-client token bucket caps each client's average rate while allowing short bursts, so one client can't use up capacity everyone shares — but set it below real traffic and you reject your own users.
200 normal users each send about 5 requests per second. Five seconds in, one client with a bug in its retry loop starts sending about 10,000 requests per second — ten times all the normal traffic together. Three servers can handle 4,500. All numbers are an illustrative model.
Errors — normal users
0%
Errors — buggy client
0%
429s/s
0/s
p95 — normal users
0 ms
Served
0/s
Servers busy
0%
Protect the normal users
With the buggy client flooding the API, keep normal users' errors under 0.5% and their p95 under 100 ms for 20 seconds.
200 normal users each send about 5 requests per second. Five seconds in, one client with a bug in its retry loop starts sending about 10,000 requests per second — ten times all the normal traffic together. Three servers can handle 4,500. All numbers are an illustrative model.
Illustrative model: rates, queues and latency follow simple queueing rules, not a production benchmark.