Inferensys

Glossary

Windowed Aggregation

A stream processing operation that continuously computes a summary statistic, like a sum or average, over a finite, time-bounded subset of an infinite event stream.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
STREAM PROCESSING FUNDAMENTALS

What is Windowed Aggregation?

A windowed aggregation is a stateful stream processing operation that continuously computes a summary statistic over a finite, time-bounded subset of an infinite event stream.

Windowed aggregation is the mechanism by which unbounded data streams are divided into finite, logical chunks called windows to enable continuous computation. Unlike batch aggregation, which operates on a static dataset, this operation applies a function—such as SUM, COUNT, or AVG—to events that fall within a specific temporal boundary, defined by either event time or processing time. This allows systems like Apache Flink to emit incremental results as the stream progresses, transforming raw event data into actionable time-series metrics.

The behavior of the aggregation is defined by the window's trigger and eviction policies. Common window types include tumbling windows (fixed-size, non-overlapping), hopping windows (fixed-size, overlapping), and session windows (dynamic gaps of inactivity). A critical companion concept is the watermark, a progress metric that tolerates late-arriving data by defining a threshold after which the system finalizes a window's result, balancing completeness against latency.

WINDOWED AGGREGATION

Core Window Types

The fundamental temporal boundaries that define how a stream processor slices an infinite event stream into finite, computable chunks. The choice of window type directly impacts the accuracy and latency of real-time aggregations.

01

Tumbling Windows

Fixed-size, non-overlapping, contiguous time intervals. Each event belongs to exactly one window. When the window ends, the aggregate is emitted and the state is purged.

  • Example: Compute total sales every 5 minutes (12:00-12:05, 12:05-12:10).
  • Key Trait: No duplication of events across windows.
  • Use Case: Regulatory reporting requiring precise, non-overlapping time buckets.
Fixed
Interval Size
No Overlap
Event Assignment
02

Hopping Windows

Fixed-size windows that advance forward by a hop size smaller than the window duration, causing overlapping intervals. An event can belong to multiple windows simultaneously.

  • Example: A 10-minute window advancing every 1 minute (12:00-12:10, 12:01-12:11).
  • Key Trait: Smoothes aggregates by providing overlapping, frequent updates.
  • Use Case: Moving average of click-through rate for a trending product.
Overlapping
Window Behavior
Hop Size
Advance Interval
03

Sliding Windows

Defined by a duration and a slide interval. Unlike hopping windows, sliding windows are typically evaluated continuously, emitting a new result every time the slide interval elapses or on every event arrival.

  • Example: Count the number of page views in the last 60 seconds, updated every 5 seconds.
  • Key Trait: Provides the most granular, real-time view of a rolling period.
  • Use Case: Real-time anomaly detection on a stream of sensor telemetry.
Continuous
Evaluation Trigger
Rolling
Temporal Scope
04

Session Windows

Dynamic windows that group events separated by a gap of inactivity. Window boundaries are defined by the data itself, not by fixed time intervals. A session ends when no events arrive for the specified gap duration.

  • Example: Group all user clicks into a single session until 30 minutes of inactivity occurs.
  • Key Trait: Captures user intent and journeys naturally.
  • Use Case: Sessionizing clickstream data for propensity scoring.
Dynamic
Window Boundary
Inactivity Gap
Defining Parameter
05

Global Windows

A single, unbounded window that encompasses the entire stream from beginning to end. Aggregations are never finalized automatically; they must be triggered by a custom policy, such as a watermark or a count of elements.

  • Example: Maintain a running total of all unique user IDs seen since the application started.
  • Key Trait: State grows indefinitely unless explicitly purged.
  • Use Case: Maintaining a global leaderboard or a cumulative lifetime value counter.
Unbounded
Window Size
Custom
Trigger Required
06

Cumulative Windows

A window that starts at a fixed point in time and expands indefinitely, accumulating all events. Unlike a global window, it has a defined start time but no end time.

  • Example: Aggregate all orders from the start of the fiscal quarter to the current moment.
  • Key Trait: Provides a running total from a specific epoch.
  • Use Case: Real-time dashboards showing month-to-date revenue against a target.
Fixed Start
Temporal Anchor
Expanding
Window Growth
WINDOWED AGGREGATION

Frequently Asked Questions

Clear, technical answers to the most common questions about computing metrics over time-bounded subsets of infinite data streams.

Windowed aggregation is a stream processing operation that continuously computes a summary statistic—such as a sum, average, count, or maximum—over a finite, time-bounded subset of an infinite event stream. Unlike batch aggregation, which operates on a static, complete dataset, windowed aggregation slices the unbounded stream into discrete, non-overlapping or overlapping intervals called windows. As new events arrive, the system assigns them to the appropriate window based on their event time or processing time. When a window closes—typically triggered by a watermark indicating all expected data has arrived—the aggregate result is emitted. This mechanism is fundamental to real-time analytics, enabling use cases like computing hourly sales totals, detecting anomalies in 5-minute sensor windows, or calculating per-session user engagement metrics.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.