Skip to content
tezvyn:
Menu

Lambda Architecture: Batch and Stream for Big Data

Source: Wikipedia: Lambda architectureMediumHow cards are made

Lambda Architecture: Batch and Stream for Big Data

Lambda Architecture splits data into two paths: a slow, comprehensive batch layer and a fast, real-time stream layer. It's used in big data systems needing both historical accuracy and live views.

Why it exists

As datasets grew massive, traditional batch processing like MapReduce became too slow for real-time needs. Businesses needed both comprehensive historical accuracy and an immediate view of current data. Lambda Architecture was designed to solve this by getting the benefits of both batch and stream processing in one system.

The mental model

Think of it as a two-lane highway for your data. One lane is the batch layer: it’s slow, wide, and carries all historical traffic, eventually providing a perfectly accurate and complete record. The other lane is the stream layer: it’s fast, carrying only live traffic to give you a good-enough, up-to-the-minute view. Your final destination, the query result, merges the views from both lanes.

How it works

All incoming data is dispatched to two layers simultaneously. First, the batch layer, which stores all the data and periodically runs batch jobs to compute a comprehensive, accurate view. Second, the speed layer (or stream layer), which processes data immediately to provide a real-time view, but only for recent data. A serving layer then combines results from both the batch view and the real-time view to answer queries, providing a complete picture.

When to use it

Use Lambda Architecture for massive-scale systems where you cannot sacrifice either historical accuracy or real-time capabilities. It is ideal for applications like large-scale analytics dashboards, financial reporting systems, or social media trend analysis that need to balance latency, throughput, and fault tolerance.

When not to use it

This architecture is complex. It's overkill for systems that do not have both massive scale and a hard real-time requirement. If your system can tolerate a few minutes of latency, a simpler batch-only system may suffice. If you only need real-time views and historical accuracy is secondary, a pure streaming architecture is less complex. The primary reason not to use it is the high operational cost of building and maintaining two separate data pipelines.

One canonical example

A system counting views on a popular website. The batch layer runs nightly to calculate the exact, canonical view count for all time up to yesterday. The stream layer continuously processes today's views in real-time. When a user requests the view count, the serving layer queries both systems and adds their results together, presenting a single, up-to-date number.

Interview question

A large e-commerce platform requires both precise daily sales reports and immediate, up-to-the-minute inventory updates. Which architecture best fits this need?

  • a.A Lambda ArchitectureCorrect
  • b.A pure stream processing architecture
  • c.A pure batch processing architecture
  • d.A microservices-based architecture
Why?

Lambda Architecture uniquely combines a batch layer for historical accuracy and a stream layer for real-time insights, addressing both needs simultaneously. Pure batch or stream systems only satisfy one requirement.

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

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

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 data engineering — each one lists the topics its interview covers.

See open roles