Track cheat sheet
Batch & stream processing cheat sheet
Process data on a schedule or as it arrives: how late an answer can be, events that arrive out of order, and batch jobs that outgrow their night.
Key concepts
- Batch or stream?
- Batch processes collected data on a schedule; stream processing handles each event as it arrives.
- Late events and windows
- Events arrive late and out of order, so the minute an event arrives is often not the minute it happened.
- The batch job that outgrew its night
- A batch job that reprocesses all history takes longer every month, until it outgrows its window.
Decision rules
- Ask how late the answer can be: stream the decisions that cannot wait, batch the rest.
- Window by event time, keep windows open for an allowed lateness tracked by a watermark, and send the very late to a corrections output.
- Process only what changed since the last run, alert on the shrinking gap to the window's end, and keep heavy jobs off the live database.
Common traps
- Putting a decision with a deadline of minutes, such as a fraud check, into a nightly batch, so it finds problems after they have shipped.
- Counting by arrival time, so late events make a false dip and then a false spike, and alerts fire on both.
- Recomputing everything every night on the shop's database, until one morning the job is still running when the rush arrives.
Lessons and boss fights
- Batch or stream? · 3 min
- Late events and windows · 3 min
- The batch job that outgrew its night · 3 min
Real outages on this track: The back-out nobody tested
BuildBreak · Batch & stream processing · each line comes from its lesson, where the sources are linked.