A platform maintains separate batch and streaming implementations of the same logic. What does that cost, and what are the alternatives?
Show the full answer Hide the answer
What the duplication costs
Two implementations of the same business logic, which will diverge. Every change must be made twice, correctly, in different frameworks with different semantics — and the divergence is silent, producing different numbers from the same events.
For machine learning this is the origin of training/serving skew: features computed one way in the batch pipeline and another in the streaming path, so the model is trained on data that differs from what it receives in production. The quality degrades silently rather than failing, which makes it the most expensive bug class in these systems.
The alternatives
Kappa — one streaming path, with reprocessing by replay. The stream is the only pipeline; correcting logic means replaying history through the new code. Removes the duplication entirely, and requires: sufficient retention to replay a meaningful window, a processing framework that can handle both live and replay throughput, and resource isolation so a replay does not starve the live path.
Unified frameworks that execute the same logic in batch and streaming modes. Reduces duplication to one implementation with two execution modes, which is a substantial improvement while not eliminating semantic differences between the modes.
A shared definition with two executions — the feature store approach. A feature is defined once and executed by both paths. Pragmatic, widely used, and it addresses the specific divergence that matters most.
What still requires batch
- Very long windows where replaying from a stream is impractical.
- Complex joins over full history.
- Model training, which needs the full dataset rather than a stream.
- Reconciliation and audit, where a clear batch boundary is easier to make correct and to explain.
The pragmatic position
Not purity, but a single definition. Whether the execution is one path or two matters less than whether the logic exists once. A shared feature definition executed by both paths captures most of the benefit without requiring a wholesale architectural commitment.
The failure to avoid is two independent implementations maintained by different teams — which is the arrangement that guarantees divergence.