100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Big Data & Distributed Computing
30 minintermediate

Windowing — Tumbling, Sliding and Session

Windowing brings structure to an unbounded data stream by grouping events into finite sets over which aggregations can be computed. Without windows, a streaming aggregation must either accumulate state forever or produce approximate results. Windows bound the aggregation scope to a defined time interval, enabling exact aggregations that are eventually emitted and forgotten. The three window types — tumbling, sliding, and session — each model a different grouping pattern, and choosing the correct one fundamentally shapes both the memory footprint and the analytical meaning of the output.

Window assignment is always based on event time in well-designed streaming pipelines, not processing time. Event-time windows produce correct results even when events arrive out of order, because each event is assigned to its window based on the timestamp embedded in the event itself. Processing-time windows produce results that depend on when events arrived at the processor — non-reproducible and incorrect whenever there is latency or reordering in the delivery path, which is true of virtually every production streaming pipeline that reads from Kafka.

Analogy🏏Cricket
🏏 Think of it like cricket: Imagine the DRS review system deployed across three independent video-review centres in Mumbai, Chennai, and London, each holding a copy of the ball-tracking data. A CAP partition is a network outage that cuts communication between them. A CP system says: if the centres cannot synchronise, no review decision is issued — no player walks until the system is restored. Consistency is guaranteed; availability is sacrificed. An AP system says: each centre issues its own decision based on its local data, even if that means Mumbai says out and London says not out — reviews continue but different centres may give different verdicts. Partition tolerance is non-negotiable because the network always has the possibility of failing; the choice is whether umpires wait for consensus or proceed with local data.
Lesson 28 of 35
0% complete