Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 137/ 160
07. Streaming & Real-Time Data Engineering

Lambda Architecture vs Kappa Architecture

Compare dual batch+speed (Lambda) vs stream-replay-centric (Kappa) platform designs.

IntermediateLambda · Kappa · Replay3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Finite history and replay capacity. Next, one stream transform or dual batch/speed code. Finally, shadow/rebuild, correction, and consumer switch.

Think of it like…

Lambda sends live telegraph updates and a later audited newspaper, requiring a reconciliation desk; Kappa keeps every edition of the wire and can regenerate the newspaper from that single source.

Where you’ve seen it

A dashboard receives approximate Flink revenue plus an hourly Spark truth job in Lambda; a Kappa design emits the same model from Kafka/Iceberg, replays a new consumer version, and swaps outputs after validation.

Words you’ll hear

Lambda
A dual-path design with batch completeness plus stream speed layers merged at serving time.
Kappa
A stream/log-centric design in which historical replay rebuilds serving state instead of maintaining separate batch logic.
Replay
Rerunning the immutable event history into a new versioned topology or table to correct state and code.
Operational boundary
Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics. Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

Visual diagram

Loading interactive diagram

Theory & deep dive

Lambda: the working mechanism

Lambda architecture keeps a batch layer for complete/recomputed truth and a speed layer for low-latency views; Kappa replays one durable stream/log to rebuild state and avoids maintaining two logic paths.

Finite history and replay capacity. One stream transform or dual batch/speed code, then approximate now, corrected later, or replay cutover; this exposes the state governed by Replay.

Lambda Architecture vs Kappa Architecture in one concrete design

A dashboard receives approximate Flink revenue plus an hourly Spark truth job in Lambda; a Kappa design emits the same model from Kafka/Iceberg, replays a new consumer version, and swaps outputs after validation.

Key takeaway: Lambda architecture keeps a batch layer for complete/recomputed truth and a speed layer for low-latency views

Lambda Architecture vs Kappa Architecture: failure mode and production response

Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics.

Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline. Track Replay time as "full retained history divided by rebuild throughput", and make Logic duplication visible to the dataset owner.

Key takeaway: Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

How it works, step by step

Step 1 of 4
Lambda

1. Compare retention

Finite history and replay capacity. Lambda architecture keeps a batch layer for complete/recomputed truth and a speed layer for low-latency views; Kappa replays one durable stream/log to rebuild state and avoids maintaining two logic paths.

finite history and replay capacity
Key numbers at this step
Replay time
full retained history divided by rebuild throughput
Kappa
A stream/log-centric design in which historical replay rebuilds serving state instead of maintaining separate batch logic.

When to use it & trade-offs

What it is

Lambda architecture keeps a batch layer for complete/recomputed truth and a speed layer for low-latency views; Kappa replays one durable stream/log to rebuild state and avoids maintaining two logic paths. A dashboard receives approximate Flink revenue plus an hourly Spark truth job in Lambda; a Kappa design emits the same model from Kafka/Iceberg, replays a new consumer version, and swaps outputs after validation.

Why it matters: Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics. Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

When to reach for it

  • Compare dual batch+speed (Lambda) vs stream-replay-centric (Kappa) platform designs.
  • Choose Lambda because it provides this capability: A dual-path design with batch completeness plus stream speed layers merged at serving time.
  • Keep evidence for Replay time at "full retained history divided by rebuild throughput" so the last production stage-Validate - shadow/rebuild, correction, and consumer switch-remains testable.

When to avoid or be careful

  • Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics.
  • Do not conflate Kappa with Lambda. The second concept contributes different behavior: A stream/log-centric design in which historical replay rebuilds serving state instead of maintaining separate batch logic.
  • Release only after this guardrail is in place: Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

Lambda / Kappa / Replay - roles, limits, and operating cost

Lambda
Best for: A dual-path design with batch completeness plus stream speed layers merged at serving time.

Strengths: A dual-path design with batch completeness plus stream speed layers merged at serving time. Lambda architecture keeps a batch layer for complete/recomputed truth and a speed layer for low-latency views.

Watch out: Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics.

Kappa
Best for: A stream/log-centric design in which historical replay rebuilds serving state instead of maintaining separate batch logic.

Strengths: A stream/log-centric design in which historical replay rebuilds serving state instead of maintaining separate batch logic. In this workflow it supports: Choose consistency - approximate now, corrected later, or replay cutover.

Watch out: The operating cost is real: number of independently implemented KPI paths.

Replay
Best for: Rerunning the immutable event history into a new versioned topology or table to correct state and code.

Strengths: Rerunning the immutable event history into a new versioned topology or table to correct state and code. Its output can be checked with Correction window.

Watch out: Operating guardrail: Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

Interview signals & numbers to know

When this topic comes up

  • “Where is the failure boundary for Lambda, and how would Replay time reveal it?”
  • “Why is Kappa distinct from this behavior: rerunning the immutable event history into a new versioned topology or table to correct state and code?”
  • Production clue: Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics.
  • Design probe: Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

Benchmarks & rules of thumb

Replay time -
full retained history divided by rebuild throughput
Logic duplication -
number of independently implemented KPI paths
Correction window -
time from detected mismatch to canonical view swap

Common mistakes & follow-ups

Common interview mistakes

  • Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics.
  • Reporting success from a job exit code without checking Replay time and Logic duplication.
  • Treating this example as complete without replay, rollback, or access boundaries: A dashboard receives approximate Flink revenue plus an hourly Spark truth job in Lambda; a Kappa design emits the same model from Kafka/Iceberg, replays a new consumer version, and swaps outputs after validation.

Likely interviewer follow-ups

  • How would you prove this contract instead of only checking that the command ran: A dual-path design with batch completeness plus stream speed layers merged at serving time.
  • What does the recovery plan do when this occurs? Lambda can implement different business rules twice, creating irreconcilable totals, while Kappa may retain an infeasible event log or struggle with full-history recompute and late correction semantics.
  • When is Lambda insufficient for Logic duplication, and what does adding Kappa cost in Replay time?
Interview tip: Lead with the data path and failure boundary: Lambda architecture keeps a batch layer for complete/recomputed truth and a speed layer for low-latency views; Kappa replays one durable stream/log to rebuild state and avoids maintaining two logic paths. Then make the answer operational: Choose Lambda only when batch correction and stream SLA require independently justified sources, or Kappa when the log retention/compaction and stream engine can replay all needed history with one versioned state pipeline.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Lambda Architecture vs Kappa Architecture with data engineer interview Q&A and hands-on practice.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Backpressure Management & Stream Scaling Strategies
Next topic
Real-Time Feature Engineering for Machine Learning