Skip to content

Lambda and Kappa architectures

Many data products need both a complete, accurate view of history and up-to-the-minute results: fraud scores, live dashboards, recommendations. Lambda and Kappa are two architectures for getting both.

  • Lambda architecture (described by Nathan Marz) runs two pipelines side by side: a batch layer that periodically recomputes accurate results over all historical data, and a speed layer that processes new events in real time. A serving layer merges the two.
  • Kappa architecture (proposed by Jay Kreps in Questioning the Lambda Architecture (opens in a new tab)) uses one streaming pipeline for everything. To reprocess history, you replay the event log through a new version of the same pipeline.
Lambda versus Kappa1. In Lambda, every event goes to both the batch layer and the speed layer. 2. The serving layer combines accurate batch results with recent real-time results. 3. In Kappa, one stream processor reads the retained event log. 4. To change the logic, a new version replays the log into a new result table, then replaces the old one.LambdaKappa Events Batch layerrecompute all historySpeed layerrecent events only Serving layermerges both views Event logretained, replayable Stream processorone codebase Results1234
Lambda versus Kappa Lambda keeps separate batch and real-time code paths; Kappa has one streaming path and replays the log when logic changes.
  1. In Lambda, every event goes to both the batch layer and the speed layer.
  2. The serving layer combines accurate batch results with recent real-time results.
  3. In Kappa, one stream processor reads the retained event log.
  4. To change the logic, a new version replays the log into a new result table, then replaces the old one.
Aspect Lambda Kappa
Pipelines Two: batch and streaming One: streaming
Codebases Two implementations of the same logic One
Reprocessing history Rerun the batch job Replay the log through a new pipeline version
Accuracy Batch layer corrects the speed layer Depends on the stream processor handling late and out-of-order events correctly
Storage need Raw history in the batch store Long retention in the event log (or tiered storage)
Main risk The two implementations disagree Replays are slow or expensive for very long histories

Lambda was a response to early stream processors that couldn’t guarantee correct results, so a batch job had to fix them later. Modern stream processors such as Apache Flink (opens in a new tab) handle event time, late data, windowing and consistent state well, and logs such as Apache Kafka (opens in a new tab) can retain data for long periods. That removed much of the need for a second pipeline, and with it the cost of writing every piece of logic twice.

In practice, many current platforms are a hybrid: a streaming pipeline writes into a lakehouse table, and the same table supports both real-time queries and batch reprocessing. The distinction matters less than it did; the lesson of both designs remains.

Lambda still fits when the batch computation is genuinely different (for example training a model over years of data while scoring events in real time), or when the real-time results only need to be approximately right and are corrected overnight.

Kappa fits when the same logic applies to history and to new events, the log can be retained or replayed from storage, and you want one codebase.

  • Lambda’s two codebases drifting apart, so dashboards change numbers overnight.
  • Kappa replays that take days because the pipeline wasn’t designed to run faster than real time.
  • Ignoring event time. Processing by arrival time gives wrong results when events arrive late or out of order.
  • Replays that repeat side effects, such as sending notifications again. Keep side effects out of reprocessing paths. See the replay that emailed every customer.

Written and edited by Abhinav Taduka, enterprise software architect.