Quick revision
The short answer
Batch jobs read a complete, bounded input on a schedule, so they are simple to test and rerun but their results are hours old. Stream processing handles each event as it arrives, keeping state and windows, so results arrive in seconds but late and out-of-order events, state recovery and exactly-once output become our problem; micro-batch sits between them by running small batches every few seconds. Lambda runs a batch layer and a speed layer side by side and merges them, at the cost of two code bases, while kappa uses only a stream processor and reprocesses history by replaying the log, which needs long retention or an archive.
What to remember
In this answer, we saw that batch processes bounded input on a schedule and is simple but late, stream processing handles events as they arrive with state and windows and is fresh but harder, and micro-batch trades a few seconds of latency for batch-like simplicity. Lambda merges a batch layer and a speed layer but needs the same logic twice, while kappa keeps one stream code base and reprocesses by replaying the log, which needs long retention or an archive.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Batch jobs read a complete, bounded input on a schedule, so they are simple to test and rerun but their results are hours old. Stream processing handles each event as it arrives, keeping state and windows, so results arrive in seconds but late and out-of-order events, state recovery and exactly-once output become our problem; micro-batch sits between them by running small batches every few seconds. Lambda runs a batch layer and a speed layer side by side and merges them, at the cost of two code bases, while kappa uses only a stream processor and reprocesses history by replaying the log, which needs long retention or an archive.
Why this question is asked
Almost every data platform is built from these two shapes of processing, and most arguments about architecture are really arguments about how fresh results must be and how much complexity we will pay for it. Interviewers ask this to check that we can explain the trade-offs in plain terms rather than reciting framework names. In this answer, we will recap bounded and unbounded data, look at batch, stream and micro-batch processing with the problems each brings, compare them in a table, and then walk through the lambda and kappa architectures and their weaknesses.
1A Quick Recap of Bounded and Unbounded Data
Bounded data has an end. Yesterday's order files are bounded: when the day closes, we know we have every order, and a job can read them all, compute, and finish. Unbounded data never ends. The stream of orders arriving in Kafka keeps growing for as long as the business runs, so any result we compute from it is a result so far.
That difference drives everything else. A job over bounded data can sort, join and aggregate the whole input because it can see all of it. A job over unbounded data has to decide when a result is ready, keep intermediate results in memory or on disk, and cope with events that arrive late or in the wrong order.
2Batch Processing
A batch job runs on a schedule, reads a complete input such as yesterday's files or a table snapshot, and writes a complete output. Spark jobs over files in object storage and SQL jobs in a warehouse are typical examples.
Its great strength is simplicity. The input is fixed, so running the job twice gives the same answer, which makes testing easy and makes a rerun the standard fix for a bug: correct the code, rerun the day, replace the output. Its weakness is latency. If the job runs at 02:00 over yesterday's data, the newest result is between a few hours and a full day old, which is fine for finance reports and useless for fraud detection.
3Stream Processing and Micro-Batch
A stream processor, such as Flink or Kafka Streams, handles each event as it arrives. To compute anything beyond a single event it keeps state, for example running totals per merchant, and groups events into windows, such as one-minute buckets.
| Property | Batch | Micro-batch | Stream |
|---|---|---|---|
| Input | Bounded, complete | Small slices of a stream | Unbounded, event by event |
| Typical latency | Hours | Seconds | Milliseconds to seconds |
| Rerun and testing | Easy | Fairly easy | Harder: state and replay |
| Late and out-of-order data | Mostly absent | Must be handled | Must be handled |
| Example | Nightly Spark job | Spark Structured Streaming | Flink, Kafka Streams |
Results now arrive in seconds, but harder problems appear. Events arrive late or out of order, so the job needs a rule for how long to wait before a window is final, which is what the grace period above expresses. State must survive crashes, so it is checkpointed and restored. And writing results exactly once to an external system needs care, because a restart can replay events.
Micro-batch is the middle ground. Spark Structured Streaming, by default, starts a new small batch as soon as the previous one finishes, typically every few seconds, and each small batch is processed with batch-style code. We trade some latency, seconds instead of milliseconds, for a simpler model that reuses batch tools and thinking.
4The Lambda Architecture
The lambda architecture tries to get both accuracy and freshness by running two systems. The batch layer recomputes complete, accurate results from all historical data on a schedule. The speed layer, a stream processor, computes fast, approximate results for the data that arrived since the last batch run. At query time, a serving layer merges the two: batch results for everything up to last night, speed results for today.
- Serving layermerges batch views with real-time views at query time
- Speed layerstream job, fresh but approximate results since the last batch
- Batch layerrecomputes accurate views from all history on a schedule
- Immutable event log and archivethe shared input for both layers
4 layers, from the top down. Step through them one at a time.
The weakness is that the same logic exists twice, once in the batch code and once in the streaming code, often in different frameworks. Every change has to be made in both, and when the two disagree, which they do after subtle bugs or different handling of late data, nobody is sure which number is right. Teams end up debugging two pipelines to explain one figure.
5The Kappa Architecture
Kappa removes the batch layer. There is only a stream processor, reading an event log such as Kafka. When the logic changes or a bug is found, we do not run a batch job; we start a second copy of the stream job with the new code, have it replay the log from the beginning, let it catch up, and then switch readers to its output.
One code base is a big win. The weakness is that reprocessing needs the history to still be there. Kafka topics usually keep days, not years, so kappa needs long retention, tiered storage or an archive in object storage that the job can read. It also needs the capacity and tooling to run a replay beside the live job without slowing it down. Replaying months of events through a streaming engine can also be slower and costlier than a batch job over the same data in columnar files.
6Follow-up questions
Which would you choose for a new analytics product?
I would start from the latency each output needs. If daily is enough, plain batch is cheapest and easiest to trust. If some outputs need seconds, I would lean towards a kappa-style design with an engine that can read both bounded archives and live streams, so one code base serves live processing and reprocessing, rather than building lambda's two pipelines.
What is a watermark in stream processing?
A watermark is the processor's estimate that no more events older than a given event time will arrive. When the watermark passes the end of a window, the window can be finalised and emitted. Events that arrive after that are late, and the job either drops them, sends them to a side output, or updates the result within an allowed lateness.
Is micro-batch real streaming?
It processes an unbounded stream continuously, so it solves the same problems, including state and late data, but in steps of a few seconds. For most dashboards and alerts that latency is fine; for decisions that need sub-second results, an event-at-a-time engine is the better fit.
7Conclusion
In this answer, we saw that batch processes bounded input on a schedule and is simple but late, stream processing handles events as they arrive with state and windows and is fresh but harder, and micro-batch trades a few seconds of latency for batch-like simplicity. Lambda merges a batch layer and a speed layer but needs the same logic twice, while kappa keeps one stream code base and reprocesses by replaying the log, which needs long retention or an archive.
Open with
Batch processing reads a complete, bounded input, like yesterday's files, on a schedule. It is simple to test and easy to rerun after a bug, but results are hours old.
Then, if they want more
Stream processing handles each event as it arrives, keeping state and windows, so results come in seconds, but I have to deal with late and out-of-order events, recovering state after a crash, and producing exactly-once output in external systems.
Micro-batch, like Spark Structured Streaming's default trigger, runs a small batch every few seconds, trading a bit of latency for a batch-style programming model. For architectures, lambda runs a batch layer that recomputes accurate results from all history and a speed layer that gives fresh, approximate results, and merges them at query time.
Its main weakness is two code bases computing the same thing, which drift apart and are painful to keep consistent. Kappa keeps only the streaming layer: to reprocess, you replay the log through a new version of the job beside the live one and switch over.
Its weakness is that it needs long log retention or an archive to replay from, and the capacity to run a replay without hurting the live job. For new systems I usually prefer a kappa-style design with an engine that can read archives too.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Compare batch, micro-batch and stream processing, and explain the lambda and kappa...": https://scrivio-interview-library.netlify.app/architecture/storage-and-pipelines/d6f93c46b4/