Batch vs Stream Processing • Lambda Architecture PatternEasy⏱️ ~3 min
What is Lambda Architecture?
Definition
Lambda Architecture is a data processing pattern that combines batch and stream processing to achieve both low latency and high correctness in large scale systems.
"Correctness comes from the batch layer, while low latency comes from the speed layer. You get both by running them in parallel."
💡 Key Takeaways
✓Lambda Architecture combines batch processing (high correctness, high latency) with stream processing (low latency, incremental updates) to get benefits of both approaches
✓The batch layer stores immutable raw events and periodically recomputes views from scratch, running every 15 minutes to 24 hours depending on business needs
✓The speed layer processes events in real time with p50 latency typically under 1 second and p99 under 5 to 30 seconds, maintaining only recent state
✓The serving layer merges results: historical data from batch views plus fresh data from speed views, presenting a unified interface to queries
📌 Interview Tips
1A ride sharing app tracks 5 million trips per day: batch layer computes daily revenue aggregates running nightly, speed layer tracks active trips and fraud scores updated every second, serving layer combines both for dashboards
2An ecommerce platform processes 200 thousand events per second at peak: batch path writes hourly partitions to data lake and recomputes customer lifetime value daily, speed path maintains real time inventory counts and cart activity