2. Batch, micro-batch, streaming
One-liner. Choose latency first; everything else follows from it.
Memorize
- Batch: cheapest per row, high throughput, stale by design. Good for finance, reporting, backfills.
- Micro-batch: small intervals, still batch semantics (Spark Structured Streaming triggers).
- Streaming: event-at-a-time, state + watermarks, ordering per key, exactly-once only within the engine.
- Lambda architecture (batch + speed layers) vs Kappa (one streaming path, replay from log).
- Late data needs a watermark and a lateness policy (drop, retry, side output).
- Streaming is operationally harder: state stores, checkpoints, backpressure.
Trap. "Real-time dashboard" built on a 15-minute batch job — the requirement was latency, not technology. Do this. Convert "real-time" into a number (seconds? minutes?) before choosing.
Check
Finance needs a report at 06:00 daily over 2 TB. Marketing wants 30-second campaign metrics. What is the correct split?
Why
Cost follows latency: a nightly scan is cheap per row; a 30 s dashboard needs incremental processing.