Tumbling Window vs Sliding Window
People think any window that comes round again is a tumbling window. Tumbling windows touch but never overlap, so each event is counted once. Sliding windows overlap, so one event falls in more than one. Use tumbling for totals and bills. Use sliding for moving averages and alerts.
Tumbling Window
Windows that are all one size. Each starts when the last ends.
A tumbling window is a window of fixed size that never overlaps the next one. Each event falls into exactly one window. A 5-minute tumbling window gives one result for 10:00 to 10:05, then one for 10:05 to 10:10, and so on. It is the simplest window and the most common.
Sliding Window
Windows of one size that overlap. Each step gives a new result.
A sliding window has a fixed size, but a new one starts at a shorter step. So the windows overlap. A 10-minute window that slides every minute gives a fresh 10-minute result each minute. One event falls into several windows. It is used for moving averages and for alerts on the last few minutes. Some tools call it a hopping window.
In one line
- Tumbling Window
- Windows that are all one size. Each starts when the last ends.
- Sliding Window
- Windows of one size that overlap. Each step gives a new result.