Tiered rate limiter with limits that change at runtime
Build a rate-limiting service in Python. Each client belongs to a tier (for example free, pro, enterprise), and each tier has its own limit. A request arrives with a client id, and the service decides whether to allow it under that client's tier.
- Implement the limiter and its interface.
- Let an operator change a tier's limits while the service runs, without a restart, and define what happens to clients mid-window.
- Write tests for it.
- Discuss how you would scale it beyond one process: shared state, accuracy versus latency, and failure behavior.
No answer yet. Write the first one; the best answer gets endorsed.
