Architecture & LLD Preview
Rate Limiter
Limit requests per client with a pluggable policy — token bucket, leaky bucket, or sliding window.
The throttling algorithm is a Strategy — TokenBucketStrategy bounds bursts by capacity with continuous refill, SlidingWindowStrategy tracks an exact timestamp log with no boundary effect — both behind one RateLimitStrategy interface, returning a structured retry-after result.
Core Design Challenge
"Design a rate limiter. Why does the naive fixed-window counter let through 2x the intended limit at a window boundary?"
What You'll Learn:
- ✦Understanding eviction policies (LRU, LFU, FIFO)
- ✦Designing O(1) time complexity maps and list structures
- ✦Thread-safety, mutex locking, and concurrent read/write access
- ✦Managing memory boundaries and cache expiration policies