How to use this token bucket calculator
Enter the throughput you want to hold and the burst you want to allow at once, and the tool reports the refill rate, the bucket size and the time an empty bucket needs to fill. Add a peak send rate and it works backwards to when the bucket empties and how many requests pass until then.
How the numbers are derived
In a token bucket the sustained rate equals the refill rate and the largest burst equals the bucket size. Filling an empty bucket takes the size divided by the refill rate, so 100 tokens at 10 per second takes 10 seconds. The time a peak is absorbed is the size divided by the peak minus the refill rate, and a peak at or below the refill rate never empties the bucket.
Limits and cautions
There is no authoritative recommended burst size, so you set the capacity yourself. The maths assumes one token per request, so convert accordingly if your design charges tokens by request size. Boundary bursts in window-based limiters belong to another tool.
Frequently asked questions
The refill rate sets the throughput you can hold indefinitely, while the bucket size sets the burst you can release at once. They are separate axes and are set separately.
More tokens accumulate while traffic is idle, so the instantaneous burst grows. The sustained rate is unchanged, but downstream systems must absorb that burst.
A leaky bucket releases at a steady rate only and allows no burst. A token bucket allows an instant burst as large as the tokens saved up.