Stream Processing

Continuous computation over unbounded data. Event time versus processing time, windows, watermarks, state, joins, and what "exactly-once" can and cannot mean.

Stream Processing

Computation over an input that has no end, where every result is provisional, time becomes a data field, and the job is a long-lived process holding state rather than a script that finishes.

Q · What actually changes about a computation when its input never ends?
Stateless Stream Processing

Filter, map, transform: operators whose output for a record depends only on that record. The cheapest, most restartable, most rescalable thing a stream can do — and a much narrower category than it first appears.

Q · Which streaming transformations can be computed from a single record, and why does that make them so much cheaper to operate?
Stateful Stream Processing

Counting, joining, windowing and deduplicating all require remembering something between records — which turns a job into a database you have to operate.

Q · Which streaming operations cannot be computed from one record alone, and what does the memory they need cost you operationally?
Streaming State

Where the state physically lives, what makes it grow, how it is snapshotted and restored — and why state size, not throughput, is the number that decides whether a streaming job can be operated.

Q · How large will this job's state get, where does it live, and how long does it take to restore after a failure?
Event Time

The time the thing actually happened, carried in the record itself — the only clock that makes a result reproducible when you process the same data again next year.

Q · If I reprocess this stream in six months, will I get the same answer — and which timestamp decides that?
Processing Time

The wall clock of the machine doing the work: always available, always monotonic, never late — and the reason a replay produces a different answer than the original run.

Q · What questions are genuinely about my system rather than about the world, and therefore belong on the processor's own clock?
Ingestion Time

The moment a record entered the processing system, stamped by one clock the platform controls — the timestamp that makes lag measurable and replay stable without pretending to know when anything happened.

Q · When did this record become my platform's responsibility, and what can I hold myself accountable for from that moment on?
Late Events

An event happened at 10:00 and arrived at 10:07. The 10:00–10:05 window was already emitted. What happens next is a policy decision, and most platforms have made it by accident.

Q · An event arrives after the window it belongs to has already been emitted — is it counted, dropped, or does the previous answer change?
Windows
▶ lab

A window is a rule that turns an infinite stream into a set of finite groups you are allowed to aggregate — and choosing the rule decides your state size, your latency and what questions you can answer.

Q · How do I compute an aggregate over an input that never ends, and what does the boundary I choose commit me to?
Tumbling Windows

Fixed size, contiguous, non-overlapping: every event lands in exactly one. The cheapest window and the only family whose results you are allowed to add together.

Q · When is a fixed, non-overlapping bucket the right boundary — and what exactly does "exactly one window per event" buy me?
Sliding Windows

Overlapping windows of fixed size, advancing by a smaller step. Every event lands in size ÷ slide of them, which is exactly the factor by which state, output and the risk of double counting all multiply.

Q · When is a rolling, overlapping view worth multiplying my state and output volume by the overlap factor?
Session Windows

Windows whose boundaries the data draws: a session runs until a key goes quiet for longer than a gap. Per-key, data-dependent, mergeable — and the only window family with no upper bound on its own size.

Q · How do I group events into bursts of activity when the boundaries are defined by silence rather than by the clock?
Watermarks
▶ lab

An estimate of how far event time has progressed, derived from the data itself. It decides when a window may be emitted and what counts as late — and it is a claim, not a measurement.

Q · How does a system that can never know whether more data is coming decide that a period is complete enough to publish?
Stream Joins
▶ lab

Joining two unbounded inputs means holding both sides in state until a time bound says you may stop holding them. Without that bound it is not a join — it is a memory leak with a schema.

Q · An orders stream and a payments stream arrive independently. What has to be true before they can be joined, and what are you agreeing to throw away when you set the bound?
Exactly-Once: Input Consumption, State Update, Output Write
▶ lab

There is no single exactly-once guarantee — there are three separate questions, one about input consumption, one about state update and one about output write, and each is bought by a different, nameable assumption.

Q · A streaming platform advertises that every event is processed once and only once. Which of the three things that could mean is being promised, and what has to be true for it to hold?