Design: Rate Limiter
Design focuses on the rate limiting component integrated with an API gateway or service. Authentication and API business logic are out of scope.
Functional Requirements
FR1: Limit the number of requests a user can make in 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 minimal latency impact on request processing
FR5: Allow configuration of limits per API endpoint
FR6: Support distributed deployment for scalability
Non-Functional Requirements
NFR1: Handle up to 100,000 requests per second
NFR2: Latency for rate limit check should be under 10ms (p99)
NFR3: Availability target of 99.9% uptime
NFR4: Rate limits must be enforced accurately across multiple servers
NFR5: System should be resilient to clock skew between servers
