Event Streaming LabPython · Bytewax

Chapter 14 · Reading

When can time move forward?

Slow partitions, idle inputs and late returns.

Prerequisites Close a window; Wait for late events. Find chapters in the course contents.

What you’ll learn

Compute a minimum input watermark and reason about the consequences of excluding idle inputs.

The situation

One checkout reports recent sales continuously. Another loses its connection. The dashboard keeps receiving events, yet a window never closes. Progress depends on all relevant inputs, not just the busiest one.

Progress is a claim about input

A watermark is an input’s declaration of event-time progress under a chosen policy. It is not a wall clock and not proof that no older record exists. A downstream event-time operator generally advances from the minimum watermark of its active inputs, because any one of them may still contribute an earlier event.

For a worked policy, close a half-open window [0,100) when the operator watermark reaches 100. The left boundary includes event time 0 and the right boundary excludes 100. Framework timestamp precision and trigger implementation can place a boundary at the last representable instant inside a window; verify exact boundary behavior in the selected API.

Silence has more than one explanation

If A advances to 120 and B stays at 90, the minimum is 90. More A records do not remove B’s possible contribution to the window. An idle-input timeout can exclude B from progress calculation, allowing A to advance the operator.

Declaring B idle trades waiting against the possibility that B will return with old data. If the downstream watermark has already advanced, it does not rewind to accommodate that return. Late-data routing, updates or dropped records must then follow an explicit operator policy.

Worked case

This worked policy uses the minimum active input watermark. Follow the operator’s progress as B goes idle and returns.

StepA watermarkB statusOperator progress
1120Active · 9090 · window remains open
2130Idle · excluded130 · window may close
3135Returns with event time 95Progress does not rewind; apply late policy

Alignment is a different tool

Watermark alignment can throttle a source that has advanced too far beyond its peers. It limits divergence and downstream state growth; it does not make a silent source produce missing events. Watermark idleness, watermark alignment and checkpoint barrier alignment solve different problems.

Use per-input progress and idle status to explain a stalled window. Record the source of timestamps, the out-of-order allowance, the active-input set and the late-data policy. A single graph of output rate cannot reveal which input is holding time back.

Think it through

Does a longer idle timeout always improve correctness?

Show hints
  1. Hint 1

    A timeout does not establish what data exists at a disconnected device.

  2. Hint 2

    Waiting longer can retain state and delay results without discovering the missing event.

Show explanation

No. It changes the policy’s latency/completeness tradeoff. A correctness claim needs a contract about timestamps, delay and the treatment of late returns. Neither a short nor a long timeout establishes that contract by itself.

How frameworks implement this

Flink propagates watermarks and supports idleness and source watermark alignment. Spark Structured Streaming derives event-time watermarks from observed data and supports policies for combining multiple watermarks; do not equate those rules with arbitrary Flink input channels. Kafka itself does not supply a universal event-time window policy.

ReferencesPrimary sources for this chapter’s design case

Use these guides to check the framework or protocol contract discussed in this chapter. Moving “stable” or “current” guides can describe a different release; check the version used by your deployment. These readings do not execute the distributed frameworks they compare.

This mark tracks what you’ve read.