Reliability / 2 / 4
Rate limiting
One noisy client can slow an API down for everyone. How to cap each client fairly: windows, token buckets, 429 answers and a counter shared by all servers.
- 13 min
- Intermediate
- 12 steps
- Partner p95
- 2 400 ms
- Honest errors
- 9 %
- Over the limit
- 90 x
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
Script → APIRequest
GET /v1/products?page=8812 HTTP/1.12
Host: api.example.com
X-Api-Key1: hidden
Response
HTTP/1.1 200 OK
X-Response-Time3: 2380 ms
X-Api-Key· hidden — The script has a valid key. The requests are allowed, just far too many.page— Page 8812: nobody reads that far. It is a crawl, not a user.X-Response-Time— Even this request waited 2.4 s in a queue behind its own siblings.
Course: 42 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes