# Lambda Architecture

**In short:** Lambda architecture sends incoming data down two paths. A slow batch path gives accurate results. A fast speed path gives quick, less accurate results. Queries combine both, at the cost of duplicated logic.

## Explanation

Big data workloads handle two kinds of data. Data at rest is stored and processed in batches. Data in motion is processed in real time. Lambda architecture keeps these two apart in separate layers (see Architecture Style for how styles are described).

Every incoming record goes down two paths.

**Batch layer (cold path).** It stores all incoming data in its raw form and runs batch processing on it. The result is called a batch view.

**Speed layer (hot path).** It analyzes data in real time. It aims for low latency, meaning fast answers. It accepts lower accuracy in return.

**Serving layer.** It indexes the batch view so queries run efficiently. The speed layer adds incremental updates based on the newest data. A query stitches together results from both systems to form a complete answer.

**Immutable raw data.** The batch layer never overwrites old data. New data is appended, and changes are stored as time-stamped events. Because the raw data stays intact, the system can recompute batch views. It can also create new views as it evolves. One well-known critic likes this idea of keeping the input data unchanged.

**Typical technology.** A big data reference architecture names Kafka to buffer streams, Spark Streaming to process them, and HBase or Hive as low-latency analytical stores.

**Alternative.** Kappa architecture has the same goals. It sends all data through one stream-processing path instead of two. To recompute results, it replays the stream within a single stream job.

## Example

An online shop wants to show sales per product. Every order goes down both paths. The batch path recomputes exact totals from all stored orders, which takes a long time. The speed path counts new orders right away, with less accuracy. The serving layer shows the last batch totals plus the quick counts for recent orders. When the next batch run finishes, its exact numbers replace the quick estimates.

## Trade-offs

**Latency versus accuracy.** The cold path is accurate but slow. The hot path is timely but less accurate. Clients choose between timely, less accurate results and accurate, delayed results.

**Complexity.** The same processing logic appears in two places, built with different frameworks. This duplicates computation logic and makes managing both paths complex. A well-known criticism is this dual-code problem: you write and maintain the transformation logic twice. Lambda also needs reprocessing and live processing to run continuously.

**Alternative.** Kappa architecture removes the second path. It replays one stream to recompute results.

Incoming data flows down a batch path and a speed path. The serving layer combines both for queries.

```mermaid
flowchart LR
  D[Incoming data] --> B[Batch layer\ncold path]
  D --> S[Speed layer\nhot path]
  B --> V[Batch views]
  V --> SV[Serving layer]
  S --> SV
  SV --> Q[Queries]
```

## Checks

- The document states which data goes through the batch (cold) path and which through the speed (hot) path.
- Raw batch-layer data is described as immutable and append-only, so views can be recomputed.
- The document explains how the serving layer combines batch views with speed-layer updates for queries.
- The latency versus accuracy trade-off between hot and cold results is stated.
- The duplicated processing logic across both paths is recorded as a known drawback.

## Related

- [Architecture Style](https://arc.fuet.ch/concepts/styles-patterns/architectural-style.md)
- [Event Sourcing with Distributed Event Log](https://arc.fuet.ch/concepts/integration/event-sourcing-with-distributed-event-log.md)
- [Stream Connector](https://arc.fuet.ch/concepts/integration/stream.md)
- [Data Architecture](https://arc.fuet.ch/concepts/data-architecture/data-architecture.md)
- [Quality Attribute Trade-off](https://arc.fuet.ch/concepts/quality-attributes/architectural-trade-off-thinking.md)
- [Scalability](https://arc.fuet.ch/concepts/quality-attributes/scalability.md)
- [Technical Debt](https://arc.fuet.ch/concepts/evaluation/technical-debt.md)
- [Command Query Responsibility Segregation](https://arc.fuet.ch/concepts/data-architecture/command-query-responsibility-segregation.md)

## Sources

- [Big Data Architectures - Azure Architecture Center | Microsoft Learn](https://learn.microsoft.com/en-us/azure/architecture/databases/guide/big-data-architectures) — learn.microsoft.com, accessed 2026-11-09
- [Questioning the Lambda Architecture – O’Reilly](https://www.oreilly.com/radar/questioning-the-lambda-architecture/) — oreilly.com, accessed 2026-11-09
