Token bucket simulator

Simulate token refill, accepted or rejected requests and remaining tokens at ordered arrival times.

The example value has been entered. Check it immediately or change the value.

Input is processed in the browser. Refreshing returns a sample value.

Result

Instructions and example

No. Insufficient tokens reject the request without reducing the balance. Simultaneous arrivals are processed in input order.

With capacity 5 and refill 2 per second, the example accepts all 7 requests and leaves 2 tokens after the final arrival at 2 seconds.

The bucket starts full and each request costs one token. Times must be nondecreasing; no live server limit is configured.

Frequently asked questions

Do rejected requests consume tokens?

No. Insufficient tokens reject the request without reducing the balance. Simultaneous arrivals are processed in input order.

Are out-of-order times or real API rate limits handled?

The bucket starts full and each request costs one token. Times must be nondecreasing; no live server limit is configured.

Calculation criteria and reference materials

Verification of calculation criteria: · Calculation·verification principles · Report errors