Rate Limiter
This page offers detailed explanations for rate limiter system design problems.
Functional Requirement
- Rate limiting is done on the server side(Talk about server side and client side rate limiting)
- User's request will be rate limited by IP address, UserId etc.
- User should be able to configure granularity of rate limiting(Day/Hour/Minute/Second)
- System should drop rate limited request and not enqueue them.
Non Functional Requirement
- System should be highly scalable
- System should have low latency
- System should priorties high availability over consistency meaning config rule should be consistent across the system over time.
Back of the Envelop Calculations
Let's say our system have to handle services,
QPS
Let's say each service has write QPS and read QPS
Total write QPS will be Services Write QPS per service QPS
Config Storages
Let's say each service has config and each config is of .
Total config storage required will be Services Config per service Storage for each config
Rate Limiting Stats Storages
Let's say each service has users
Total stats storage required will be Services Users of Storage for each stat