Tumbling vs sliding windows

A tumbling window closes and a new one starts, so each event lands in one window. A sliding window moves by a small step, so each event lands in many windows. With a 1-hour window and a 1-minute step, each call counts in 60 windows. At 40,000 calls/s, sliding windows fail 97 percent of requests.

Play the level

Each worker adds one network cardDrag or use arrow keys to change the workers

2 workers · 1 TB moves in 1.1 h · 1,000 Mbps per card

Case 1

20,000 customers send 40,000 calls/s. Each call must be in exactly one hourly bill. The counter has 8 vCPU and 16 GB of RAM.

Case 1
Measure Goal Tumbling 1-hour windows Sliding 1-hour, 1-minute step
p99 latency under 200 ms 2 ms Pass 9.3 s Fail
Error rate under 0.1% 0% Pass 96.8% Fail
Monthly cost 64 USD/mo 64 USD/mo
TCPUsersStream proc…2 vCPU · 4 GB × 4
TCPUsersStream proc…2 vCPU · 4 GB × 4
Tumbling 1-hour windows: meets the goals
TCPUsersStream proc…2 vCPU · 4 GB × 4
TCPUsersStream proc…2 vCPU · 4 GB × 4
Sliding 1-hour, 1-minute step: misses a goal