Rate limiting
Preventing an operation from happening more times than a limit per period.
Example
With 100 requests per minute per user, request 101 is rejected.
Test yourself: Rate limiting
Rate limiting
What does rate limiting do?
With 100 requests per minute, request 101 in that minute is rejected.
Rate limiting
You have 5 nodes and a limit of 100 requests per minute per user. How do you enforce it?
If each node counts alone, the user can make 100 on each: 500 in total. With 1 counter in Redis, all 5 see the same number and request 101 is rejected.
Rate limiting
When a client goes over the limit, it's best to retry instantly and nonstop.
Retrying nonstop adds more requests; waiting 1, 2 and 4 seconds gives the limit time to free up.
0/3
â–¶ Play