Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. Stateful vs stateless processing

Batch & Streaming · Core Concepts

Stateful vs stateless processing

Easystream-05
statefulstatelesswindowscheckpoint

Question

What is the difference between stateful and stateless stream processing?

Solution

Stateless processing looks only at the current event. Map, filter, and simple projections are usually stateless. Restart is easy: no memory of the past to restore.

Stateful processing remembers something across events: running counts, last seen value, session windows, joins between streams. That memory is state, often keyed by user_id / order_id.

Stateless:  event -> filter(amount > 100) -> sink
            (no memory)

Stateful:   event -> update count[user] += 1 -> emit if count > 5
            needs keyed state store + checkpointing

Tiny example

  • Stateless: tag each click with is_mobile
  • Stateful: count clicks per user in the last 5 minutes (needs window + state)

Why it matters

State must be checkpointed for recovery. Skewed keys blow up memory. Exactly-once sinks care about state + offsets together.

Interview tip: If the answer depends on "what happened before," it is stateful. Then mention keys, checkpoints, and TTL.

PreviousNext