Token bucket.
also: token buckets · token-bucketA bucket refills with tokens at a steady rate up to a cap; each request spends one, allowing controlled bursts up to the cap.
the two-minute refresher
- Two knobs: refill rate (10 tokens/s) and capacity (50 tokens).
- A full bucket absorbs a burst of 50; after that, traffic is held to the refill rate.
- Costly operations can spend more than one token.
- Pick it when you want to allow bursts but cap the average.