Design a Rate Limiter — Concept Check
Questions on Design a Rate Limiter. Implement multiple rate-limiting algorithms — Token Bucket, Sliding Window, Fixed Window — behind a common interface with thread-safe implementations.
Questions in this quiz
8 questions on Design a Rate Limiter — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A service uses a Token Bucket rate limiter. If requests are being denied even with low traffic, what could be the issue?
- AThe windowSeconds value is too short
- BThe maxTokens value is set too high
- CThe refillRatePerSecond is too high
- DTokens are not refilling due to incorrect timestamp updates
2.In a Sliding Window Log rate limiter, what happens if the deque is not cleaned up properly?
- AMemory usage increases over time
- BRate limiting becomes more accurate
- CThe algorithm switches to Fixed Window behavior
- DRequests are denied even when under limit
3.Which rate limiting algorithm should you choose for strict constant rate limiting without bursts?
- AFixed Window
- BLeaky Bucket
- CToken Bucket
- DSliding Window
4.A developer implements a Fixed Window rate limiter but notices boundary bursts. What is likely happening?
- AThe refill rate is set too low
- BThe window size is too large
- CTokens are refilling too quickly
- DRequests are concentrated at the window boundary
5.Why might a CompositeRateLimiter be used in a system?
- ATo combine per-user and global limits
- BTo reduce the memory usage
- CTo increase the refill rate
- DTo switch between algorithms dynamically
6.In Java, what ensures thread safety in TokenBucketRateLimiter?
- AReentrantLock
- BVolatile variables
- CAtomicLong and ConcurrentHashMap
- DSynchronized blocks only
7.A Sliding Window Log limiter is used, but requests are being denied unexpectedly. What could be wrong?
- AThe deque size is too small
- BThe windowSeconds is too long
- CThe maxTokens value is too high
- DTimestamps are not added correctly
8.What is a key disadvantage of the Sliding Window Log algorithm?
- AIt does not support bursting
- BIt cannot handle high concurrency
- CIt allows boundary bursts
- DIt is memory intensive