Skip to content
tezvyn:

Lambda Architecture: Batch + Stream for Big Data

Source: Wikipedia: Kappa architectureMediumHow cards are made

Lambda Architecture: Batch + Stream for Big Data

Lambda Architecture handles massive datasets by combining slow, accurate batch processing with fast, real-time stream processing. It's used for analytics needing both historical and live views.

Why it exists

As datasets grew massive, systems needed to provide real-time analytics without sacrificing the comprehensive accuracy of traditional batch processing. Lambda Architecture was designed to solve this trade-off, balancing latency, throughput, and fault-tolerance for big data workloads.

The mental model

Think of Lambda Architecture like two parallel accounting systems. You have a meticulous, end-of-year ledger that is perfectly accurate but slow to produce (the batch layer). You also have a live cash register feed that shows every transaction as it happens (the stream layer). To know the company's exact financial state, you consult both.

How it works

Data is processed along two parallel paths. First, the 'batch layer' stores all incoming data and periodically runs batch jobs (like MapReduce) to produce comprehensive, accurate views. Second, the 'speed layer' or 'stream layer' processes data in real time as it arrives to provide immediate, though potentially less complete, views. A 'serving layer' then merges results from both the batch and real-time views to answer queries, providing a complete and up-to-date picture.

When to use it

Use Lambda Architecture for large-scale systems that must handle massive quantities of data and require both low-latency, real-time views and comprehensive, historically accurate reports. It is ideal for complex analytics dashboards, fraud detection systems, and other applications where both speed and accuracy are critical.

When not to use it

Avoid Lambda when the operational complexity of maintaining two separate data pipelines outweighs the benefits. If a single stream-processing system can meet your latency and accuracy needs, the dual-path approach adds unnecessary overhead, cost, and risk of the two codebases diverging.

One canonical example

A social media platform's trending topics dashboard. The batch layer recalculates the all-time popularity of every hashtag once a day. The stream layer counts hashtag mentions in the last minute. The dashboard queries both to show what's trending right now in the context of its overall historical popularity.

Interview question

What core challenge is the Lambda Architecture specifically designed to overcome in big data systems?

  • a.Reducing the latency of data ingestion from various disparate sources.
  • b.Ensuring data consistency across multiple distributed databases.
  • c.Providing both immediate, real-time data views and comprehensive, historically accurate reports.Correct
  • d.Minimizing the computational resources required for processing extremely large datasets.
Why?

Lambda Architecture's primary purpose is to reconcile the need for fast, real-time insights with the demand for complete, accurate historical analysis from massive datasets. While reducing latency (Option A) is a benefit of the stream layer, the architecture's core innovation is combining this with accurate historical views, which a single stream system cannot fully provide.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on architecture — each one lists the topics its interview covers.

See open roles