Apache Storm Component Guide
Also available as:
PDF
loading table of contents...

An Overview of Windowing Concepts

Sliding Windows

In a sliding window, tuples are grouped within a window that slides at rate specified by a specified sliding interval. A time-based sliding window with a length of 10 seconds and a sliding interval of 5 seconds will contain tuples that arrive within a 10-second window. The set of tuples within the window will be evaluated every 5 seconds.

In the following image, the first window (w1, in the box with dashed lines) contains events that arrived between the zeroth and tenth seconds. The second window (w2, in the box with solid lines) contains events that arrived between the fifth and fifteenth seconds. Note that events e3 through e6 are in both windows. When window w2 is evaluated at time t = 15 seconds, events e1 and e2 are dropped out of the event queue.

Tumbling Windows

In a tumbling window, tuples are grouped in a single window based on time or count. A tuple belongs to only one window.

For example, consider a time-based tumbling window with a length of five seconds. The first window (w1) contains events that arrived between the zeroth and fifth seconds. The second window (w2) contains events that arrived between the fifth and tenth seconds, and the third window (w3) contains events that arrived between tenth and fifteenth seconds. The tumbling window is evaluated every five seconds, and none of the windows overlap: