Rate Limiter Playground
Compare how token bucket, leaky bucket, fixed window, and sliding window handle traffic.
Algorithm
Token Bucket
Accepted
0
Rejected
0
Pass rate
0%
Token Bucket0.0 / 10
Tokens0.0 / 10
Tokens refill at 5 per second. Request accepted when tokens ≥ 1.
Decision history
Run to stream requests.
Accept 0Reject 0
How this simulator works
Four rate limiting strategies. Watch how they smooth traffic and why each matters.
The four algorithms
- Token Bucket — bucket holds tokens, refills over time. Allows bursts up to capacity.
- Leaky Bucket — queue drains at fixed rate. Smooths output even with burst input.
- Fixed Window — counts requests per fixed time window. Resets count at window boundary.
- Sliding Window — counts requests in the past N seconds. No reset boundary, smoother.
Key insight
Token bucket allows bursts then refills. Leaky bucket smooths output. Window-based approaches are simpler but can allow double rate at windows.