Skip to content
About
Main content

Micro-batch versus record-at-a-time

Where do the two execution models really differ, if both batch?

Two models of execution exist.

  • Record-at-a-time (continuous): each record flows through the individually.
  • Micro-batch: the engine collects records for a short interval (for example 1 second) into a small batch, and runs a small batch job on it.

The trade is per-record fixed costs versus per-batch fixed costs: the fixed-cost law applied to the scheduling boundary rather than to I/O.

Micro-batch amortizes task scheduling, coordination and state access over N records. It also unlocks batch-world optimizations: vectorized execution (processing many values per instruction), whole-stage code generation (compiling a chain of operators into one function), and columnar state access. Its costs: it floors at the batch interval, and it makes latency bimodal under load. Example: with a 1-second interval, if a batch takes 1.5 seconds to process, the next batch must , and its records wait even longer, so latencies suddenly jump from about 1 s to several seconds.

Record-at-a-time floors latency at per-hop network time plus . It pays per-record overhead everywhere. And it needs continuous checkpointing machinery (, A consistent cut), rather than getting a natural transaction boundary for free.

The folklore correction

The usual belief is " means high latency, continuous means low latency". The gap has closed from both ends. Micro-batch intervals fell to sub-second. Continuous engines added internal buffering with flush timeouts (keyBy and key groups), which is micro-batching at the network boundary.

The real remaining difference is not latency in principle but:

  • where the batching boundary sits, and
  • whether it is adaptive. A fixed batch interval is a static decision. A is a per-channel adaptive one that degrades to full-buffer batching under load automatically.

And the durable reason micro-batch persisted is not . It is that the batch is a natural transaction boundary. A batch has a clear start and end, so exactly-once and recovery are straightforwardly correct, without barrier alignment and .

Micro-batchRecord-at-a-time
Fixed costs paidper batchper record (or per buffer)
Latency floorbatch intervalnetwork hop + processing
Under overloadbimodal (batches queue)gradual (buffers fill, )
Transaction boundarynatural (the batch)needs barriers and 2PC
Batch optimizations (vectorization)easyharder
Batching boundaryfixed intervaladaptive per channel