Problem
Business users want results within seconds, but accurate answers require reprocessing the full history. A single engine historically could not deliver both freshness and correctness at scale.
Also known as: lambda-data-architecture
Combine a batch layer for accurate recomputation with a speed layer for low-latency views over the same data.
Business users want results within seconds, but accurate answers require reprocessing the full history. A single engine historically could not deliver both freshness and correctness at scale.
Lambda architecture, described by Nathan Marz, splits analytics into a batch layer, a speed layer, and a serving layer. The batch layer is the source of truth: it recomputes views from an immutable event log. The speed layer fills the gap for data that arrived since the last batch run.
Every event is written once to the master dataset and also fanned out to the stream path.
events --> master dataset --> batch job (hourly/daily) --> batch view --+
| +--> serving/query merge
+-----> stream processor (incremental) -------------> realtime view -+
A query for total orders today reads the batch view up to the last completed run boundary and adds the real-time view for events after that boundary. When the next batch run finishes, the real-time view for the covered period is truncated. Because the batch layer always recomputes from raw data, bugs in the speed layer are self-healing within one batch cycle.
The cost is that aggregation logic exists twice, often in different frameworks such as Spark for batch and Flink or Storm for streaming. Teams reduce this with shared libraries or unified APIs such as Apache Beam.
High - two processing stacks plus serving store
High - keep both paths consistent
High - dual mental model
Batch and speed layers drift and return different numbers
Window handoff double counts or drops events
Batch run delays leave serving view stale