Lambda Architecture
Batch layer (accurate, slow) + speed layer (real-time, approximate) + serving layer merging both for analytics.
Interview tip Lead with a 30-second definition, then one real system example and name 2–3 designs where Lambda Architecture is non-negotiable.
① What it is (30 seconds)
Batch layer (accurate, slow) + speed layer (real-time, approximate) + serving layer merging both for analytics.
② How it works in system design
Immutable event log (Kafka). Speed: Flink/Spark Streaming updates real-time views. Batch: nightly Spark job recomputes truth. Query merges batch + speed results for complete picture.
Typical placement
Client→Edge / Gateway→Lambda→Services→Data stores
③ Concrete system design example
Scenario: Google Analytics real-time: streaming layer shows last 30 min active users; batch layer corrects counts overnight including late-arriving events.
④ Important interview Q&A
| Question | Answer |
|---|---|
| Lambda vs Kappa? | Kappa: single stream processing retriggers on new code — simpler if replay affordable. |
| Complexity cost? | Two pipelines to maintain; many teams move to unified stream-batch (Flink). |
| Late data? | Batch layer reconciles what speed layer missed or approximated. |
⑤ Seen in these system designs
- Google Real-time Analytics — speed + batch
- Google Trends — rollup pipeline
- Apache Spark — batch layer
In interviews, after explaining the concept, say: "This shows up directly in …" and link two designs.
⑥ Revision checklist
- Speed vs batch layer
- Immutable log
- Merge at query
- Late event handling
- Kappa alternative