- Step 1 - Understand the problem and establish design scope
- Step 2 - Propose high-level design and get buy-in
- Step 3 - Design deep dive
Step 1 - Understand the problem and establish design scope
What is it? Used to limit number of requests. Examples:
- A user can write no more than 2 posts per second.
- You can create a maximum of 10 accounts per day from the same IP address.
- You can claim rewards no more than 5 times per week from the same device.
Step 2 - Propose high-level design and get buy-in
Algorithms: based on IP, or some limit (subscription limit), or user id?
- Token based
Step 3 - Design deep dive
Let’s answer to this questions now.
- How are rate limiting rules created? Where are the rules stored?
- How to handle requests that are rate limited?