Skip to content

Token Bucket

Spicy — senior dev territoryBackend

ELI5 — The Vibe Check

A token bucket is a rate limiting algorithm. Imagine a bucket that fills with tokens at a steady rate. Each request costs one token. If the bucket is empty, you're rate limited. If it's full, you can burst a bunch of requests at once. It balances steady throughput with burst tolerance.

Real Talk

The token bucket algorithm controls request rate by maintaining a bucket that refills at a fixed rate (tokens per second). Each request consumes a token. If the bucket is empty, the request is rejected or queued. The bucket has a maximum capacity allowing burst traffic up to that limit. It provides smoother rate limiting than fixed window approaches.

When You'll Hear This

"Our rate limiter uses a token bucket allowing 100 requests/minute with bursts up to 20." / "Token bucket is more forgiving than fixed window because it allows short traffic bursts."

Made with passive-aggressive love by manoga.digital. Powered by Claude.