Leaky Bucket
ELI5 — The Vibe Check
A leaky bucket processes requests at a fixed rate, like water dripping from a bucket. No matter how fast requests pour in, they come out at a steady drip. Excess requests overflow (get dropped). It smooths bursty traffic into a constant stream.
Real Talk
The leaky bucket algorithm queues incoming requests and processes them at a fixed rate, regardless of arrival rate. The bucket (queue) has a fixed capacity; excess requests are dropped when full. Unlike token bucket (which allows bursts), leaky bucket enforces a strict constant output rate. Used for traffic shaping and ensuring steady downstream processing.
When You'll Hear This
"Leaky bucket ensures our payment processor never gets more than 50 requests/second." / "Use leaky bucket when the downstream service needs a strictly constant request rate."
Related Terms
Fixed Window
Fixed window rate limiting counts requests in fixed time blocks (e.g., per minute). Simple: reset the counter every 60 seconds. The catch?
Rate Limiting
Rate limiting is like a bouncer who says 'you can come in 100 times per hour, then you wait.
Sliding Window
Sliding window rate limiting counts requests in a moving time window.
Token Bucket
A token bucket is a rate limiting algorithm. Imagine a bucket that fills with tokens at a steady rate. Each request costs one token.