Distributed Stream Processing

Separate event time, watermarks, checkpoint recovery, and the exact boundary of exactly-once effects in distributed stream processing.

Source
Anbloq
Language
English
Created
Updated
Chapters
3
Reading time
2 min
In this article3 chapters
  1. Event time places a record in its window
  2. A watermark drives the release of state
  3. Recovery requires an output contract

Event time places a record in its window

Telemetry can be recorded at a device and delivered later, perhaps in a different order. Event time \(t_e\) defines the meaning of time windows. Processing time records when work reaches the system. For a half-open window \([a,b)\) and value function \(w(e)\), the intended result is

\[ C_{[a,b)}=\sum_{e:\,a\le t_e<b}w(e). \]

An observation with event time 09:07 that arrives at 09:12 contributes to the 09:00–09:10 window. If an early count was emitted before it arrived, a sink can replace the previous count under the same window key or apply a precisely identified correction.

A watermark constrains which earlier events are expected to arrive. Checkpoint barriers mark a recoverable processing boundary, while exactly-once effects require a matching contract at the sink.

A watermark drives the release of state

A watermark is a lower bound on future event times when a source can provide that guarantee. In systems with heuristic watermarks it is an estimate and late records can still arrive. The minimum of active input watermarks limits safe downstream progress for multi-input windows. Idle input handling therefore needs an explicit policy, including what happens when that input resumes. Allowed lateness and retention specify how long an operator can still revise a result. Triggers determine when to emit early or updated results.

Recovery requires an output contract

A consistent checkpoint ties consumed source positions to operator state. Replay can reconstruct local state after a failure. If a sink write completed just before the crash, replay may attempt it again. Exactly-once effects then require a transactional sink protocol or durable deduplication using stable identities under explicit assumptions. An acknowledgement alone cannot tie external effects to checkpoint progress. Compare commit coordination in distributed transactions, logical clocks for ordering dependencies, and incremental view maintenance for correcting a previously emitted aggregate.[1][2]

References

  1. Tyler Akidau et al., The Dataflow Model ↩
  2. Tyler Akidau et al., MillWheel: Fault-Tolerant Stream Processing at Internet Scale ↩