Advanced
Distributed System Rate Limiter
Design a robust, distributed rate-limiting algorithm for a high-scale API.
📝 Contenuto del prompt
Explain the architectural design for a distributed rate limiter that must enforce 10,000 requests per minute per user across a globally distributed system of 100 servers. Address how you would handle race conditions, clock synchronization issues (using vector clocks or logical timestamps), and memory efficiency. Discuss the trade-offs between using a centralized Redis store versus a decentralized token bucket approach. Provide pseudocode for the core logic of the token bucket refill and consumption mechanism.