Design: Rate Limiting System for Microservices
Design the rate limiting mechanism and its integration with microservices APIs. Out of scope: detailed API business logic, user authentication mechanisms.
Functional Requirements
FR1: Limit the number of requests a user or client can make to an API within a given time window
FR2: Support different rate limits for different users or API keys
FR3: Provide real-time feedback when limits are exceeded
FR4: Ensure rate limiting works correctly in a distributed microservices environment
FR5: Allow configuration changes without downtime
Non-Functional Requirements
NFR1: Handle up to 100,000 requests per second across all services
NFR2: Enforce limits with p99 latency under 50ms
NFR3: Achieve 99.9% availability
NFR4: Support horizontal scaling of microservices
NFR5: Avoid single points of failure