The lab starts with a burst that straddles a window edge. All five limiters see exactly the same arrivals. The first chart shows how many requests each admitted in the last 20 ticks, against the limit. The table lists the worst window each one allowed, and the state it needed.
Predict before you press play
limit = 20 per 20 ticksrate = 1 per tickoffered so far 40 requests in 70 ticks
Requests admitted in the last 20 ticks
Limit (20)
Fixed window
Sliding window log
Sliding window counter
Token bucket
Leaky bucket (queue)
Requests admitted in the last 20 ticks (admitted against time)
Series
Latest
Lowest
Highest
Limit (20)
20
20
20
Fixed window
0
0
40
Sliding window log
0
0
20
Sliding window counter
0
0
20
Token bucket
0
0
21
Leaky bucket (queue)
0
0
20
Requests rejected so far
Fixed window
Sliding window log
Sliding window counter
Token bucket
Leaky bucket (queue)
Requests rejected so far (rejected against time)
Series
Latest
Lowest
Highest
Fixed window
0
0
0
Sliding window log
20
0
20
Sliding window counter
20
0
20
Token bucket
19
0
19
Leaky bucket (queue)
19
0
19
Requests arriving at each tick
Requests arriving at each tick (arrivals against time)
Series
Latest
Lowest
Highest
Arrivals
0
0
20
All five on the same traffic
Each row is one algorithm. Worst window is the most it admitted in any 20 ticks in a row, against a limit of 20.
Algorithm
Admitted
Rejected
Worst window
Peak state per client
Mean delay
Fixed window
40
0
40 (2x the limit)
2 values
none
Sliding window log
20
20
20
20 values
none
Sliding window counter
20
20
20
3 values
none
Token bucket
21
19
21 (1.1x the limit)
2 values
none
Leaky bucket (queue)
21
19
20
20 values
10.0 ticks
Red means a window let through more than the limit. Memory counts values stored per client: the log keeps one timestamp per admitted request, the leaky bucket keeps its queue, and the rest keep two or three numbers.
Fixed window: admitted 40, rejected 0, worst 20-tick window 40 against a limit of 20, peak state 2 values.
Sliding window log: admitted 20, rejected 20, worst 20-tick window 20 against a limit of 20, peak state 20 values.
Sliding window counter: admitted 20, rejected 20, worst 20-tick window 20 against a limit of 20, peak state 3 values.
Token bucket: admitted 21, rejected 19, worst 20-tick window 21 against a limit of 20, peak state 2 values.
Leaky bucket (queue): admitted 21, rejected 19, worst 20-tick window 20 against a limit of 20, peak state 20 values, mean delay 10.0 ticks, longest 19.
Switch the traffic to Bursty. Look at the rejected chart. The token bucket and the leaky bucket reject the same share, but one of them delays the requests it admits.
Switch to Steady and set the offered traffic to 0.8 of the limit. The average is under the limit, yet some algorithms still reject requests. Find which ones, and why.
Shrink the bucket size to 4. The refill rate has not changed. See what happens to the token bucket under bursty traffic.
Raise the limit to 60 and read the peak state column. Which algorithms get bigger?
Change the seed. The numbers move a little, but the ordering of the algorithms should not.
The full-page lab also has five guided experiments you can apply with one click.