Token bucket rate limiting and bursts
Simulate the specified token bucket over time to examine bursts and the breakdown of accepted and rejected requests.
A single bucket starts full. A request whose token cost exceeds the current balance is rejected immediately. Rejected requests consume no tokens and are not queued.
Results
—requests
—requests
- Final balance
- —tokens
- Tokens consumed by accepted requests
- —tokens
Results update automatically when the required values are entered.
Method, applicability and sources
Calculation method
Let B be capacity, R the refill rate (tokens/s), tᵢ the event time and Lᵢ the required tokens. Balance just before the decision = min(B, balance after the previous decision + R×(tᵢ−tᵢ₋₁)). If the balance is at least Lᵢ, accept the request and subtract Lᵢ; otherwise, reject it and leave the balance unchanged. The initial balance is B. Equal timestamps have a difference of 0 s. Displayed values are rounded to at most 9 decimal places; decisions use the unrounded values.
Worked example (hypothetical values)
Example: with a refill rate of 2 tokens/s, capacity 3, and requests (seconds, required tokens) of (0,2), (0,2), (1,2) and (1.5,1), 3 requests are accepted, 1 is rejected and the final balance is 1 token.
Applicability and limitations
One request sequence shares one bucket. Each accepted request consumes its full positive integer token cost at once. Excludes waiting, retries, queuing, smoothing, synchronization between distributed nodes, fixed or sliding windows, multiple buckets, loose conformance, and interpretation of dates or time zones.
Methods used
- Single token bucket with strict conformance (RFC 3290 (May 2002), Appendix A.4): scope Full initial bucket, capacity limit, continuous refill, and acceptance with full token consumption or rejection in event order; region global
Method and sources
Method: RFC 3290 (2002), §5.1.3 / Appendix A.4; discrete-event calculation with continuous refill, v1. Data recorded: 2026-11-13.