Design a rate limiting service that protects API endpoints from abuse. The rate limiter should sit in front of API servers and limit the number of requests a client can make within a given time window. When the limit is exceeded, requests should be rejected with an appropriate error response (HTTP 429).
Functional requirements
- Limit requests per client/IP within a time window
- Support configurable rate limits per endpoint
- Return HTTP 429 when limit is exceeded
- Support multiple algorithms (token bucket, sliding window)
Non-functional requirements
- Minimal latency overhead (< 10ms per request)
- Accurate counting under high concurrency
- Distributed rate limiting across multiple servers