Problem
Maintaining parallel batch and streaming implementations doubles code and creates inconsistent results. Teams want one pipeline that serves both live and historical computation.
Also known as: streaming-first-architecture
Handle all data processing as a stream over a replayable log, removing the separate batch path.
Maintaining parallel batch and streaming implementations doubles code and creates inconsistent results. Teams want one pipeline that serves both live and historical computation.
Kappa architecture, proposed by Jay Kreps, argues that a replayable log makes the batch layer of lambda redundant. Batch is simply a stream processed from an early offset at high speed.
Producers append to a partitioned log. One or more stream jobs maintain materialized views. Logic changes are handled by running two job versions side by side.
sources --> log (retained) --> job v1 --> table_v1 --> serving
\--> job v2 (from offset 0) --> table_v2
switch serving to table_v2 when caught up
The new job reads historical offsets as fast as the cluster allows, builds a complete table, and only then does the serving layer repoint. The old job and table are deleted after validation. Tiered storage, as offered by Kafka and Pulsar, makes keeping months or years of events affordable by moving old segments to object storage.
Determinism is essential: the job must produce the same output from the same input, which means using event time rather than wall-clock time, and externalizing randomness.
Medium - log cluster plus stream processors
Medium - state, checkpoint and replay tuning
Medium - event-time semantics
Replay overwhelms the log or downstream sinks
Schema changes break old events during replay
Non-deterministic jobs produce different results on rerun