Rate limiting
Send requests to a fixed window, a sliding log, a sliding counter and a token bucket at once, and watch each one decide: 200 or 429.
Four rate limiters, one client
Or play:
Send requests faster than 5 every 5 seconds and watch each limiter decide. Or play a scenario.
- —
Fixed window
Counts per 5 s window, then resets
0 of 5 this window
resets in 5.0 s0 allowed · 0 refused - —
Sliding log
Remembers each request for 5 s
0 of 5 in the last 5 s
0 allowed · 0 refused - —
Sliding counter
Weights the last window by how much is still in view
0 × 1.00 + 0last window 0 × 1.00 in view + this window 0
= 0.0 of 50 allowed · 0 refused - —
Token bucket
Holds 5 tokens, gains 1 a second
5.0 of 5 tokens
each request spends one0 allowed · 0 refused