Follow Datanami:
November 21, 2023

Batch Processing and Stream Processing: A Complementary Union for Modern Data Engineering

Yingjun Wu


In the fast-evolving world of data engineering, two methods of  data analysis have emerged as the dominant, yet competing, approaches: batch processing and stream processing.

Batch processing, a long-established model, involves accumulating data and processing it in periodic batches upon receiving user query requests. Stream processing, on the other hand, continuously performs analysis and updates computation results in real-time, as new data arrives. While some proponents argue that stream processing can entirely replace batch processing, a more comprehensive look reveals that both have their unique strengths and play critical roles in the modern data stack.

The Essential Distinctions Between Stream Processing and Batch Processing

At their core, stream processing and batch processing differ in two critical aspects: the driving mechanism of computation and the approach to computation. Stream processing operates on an event-driven basis, responding instantly to incoming data. Stream processing systems continuously receive and process data streams, performing calculations and analysis in real-time as new data arrives.

In contrast, batch processing relies on user-triggered queries, accumulating data until a threshold is met, and then performing computations on the complete dataset.

In its approach to computation, stream processing employs incremental computation, processing only the newly arrived data without reprocessing the existing data, offering low latency and high throughput. This approach delivers quick results for real-time insights and rapid response.


Batch processing, on the other hand, uses full computation, analyzing the entire dataset without consideration for incremental changes. Full computation typically demands more computational resources and time. This makes batch processing suitable for scenarios involving complete dataset summarization and aggregation, such as historical data analysis.

The Superiority of Stream Processing in Real-Time Demands

While batch processing has been a reliable workhorse in the data world, it struggles to fulfill real-time requirements for freshness, especially when results need to be delivered within seconds or sub-seconds. To achieve faster computation results with batch processing, users may consider using orchestration tools to schedule computations at regular intervals. Pairing orchestration tools with batch processing jobs at regular intervals could suffice for large-scale datasets, but it falls short for ultra-fast real-time needs.

Additionally, users may need to invest in additional compute resources in order to process large datasets more frequently, leading to increased costs.

Stream processing excels in high-speed responsiveness and real-time processing, leveraging event-driven and incremental computations. Unlike batch processing, stream processing can deliver fresh, up-to-date analysis and insights without incurring substantial computational overhead or resource utilization.

The Limitations of Stream Processing and the Indispensability of Batch Processing

Despite the strengths of stream processing, it cannot entirely replace batch processing due to certain inherent limitations. Complex operations and analyses often require consideration of the entire dataset, making batch processing more suitable. Incremental analysis in stream processing may not provide the required accuracy and completeness for such scenarios.


Stream processing also faces challenges when dealing with out-of-order data and maintaining eventual consistency. Moreover, achieving true consistency in stream processing can be intricate, and the risk of data loss or inconsistent results is always present. For certain computations, interactions with external systems can lead to compromised data and performance delays.

A Unified Approach: Coexistence and Complementarity

In practice, a unified approach that incorporates both batch processing and stream processing can yield the best results. There are three main approaches to implement unified stream-batch processing systems. Firstly, stream processing can replace batch processing entirely. The second approach is using batch processing to emulate stream processing by adopting micro-batching. The third approach involves separately implementing stream processing and batch processing and encapsulating them through an interface.

The first approach is implemented by Apache Flink, where  a stream processing core replaces traditional batch processing, offering real-time capabilities. However, this approach lacks optimizations like vectorization available in batch processing, compromising performance.

Spark Streaming, on the other hand, employs micro-batching to process data streams, balancing real-time processing with computational performance. Nonetheless, it cannot achieve true real-time processing due to its batch processing nature.


A third approach involves separately implementing stream processing and batch processing systems and encapsulating them through an interface. This approach may be more complex in engineering, but it provides better control over the project scale and allows tailored optimization for specific use cases.

The first approach may have weaker computational performance, the second approach may face timeliness issues, and the third approach may involve significant engineering efforts. Therefore, when choosing an approach to implement a unified stream-batch processing system, it is necessary to carefully consider and weigh the trade-offs based on specific business and technical requirements.

Embrace the Synergy

In the ever-changing landscape of data analysis, the coexistence and complementarity of batch processing and stream processing are paramount. While stream processing offers real-time processing and flexibility, it cannot fully replace batch processing in certain scenarios. Batch processing remains indispensable for computations requiring complete dataset analysis and handling out-of-order data.

By combining the strengths of both approaches, data engineers can create a powerful and versatile data stack that meets diverse business needs. Choosing the right approach depends on specific requirements, technical considerations, and the desired level of real-time processing. Embracing the synergy between batch processing and stream processing will pave the way for more efficient and sophisticated data analysis, driving innovation and empowering data-driven decision-making in the future.

About the Author: is the founder and CEO of RisingWave Labs, an early-stage startup developing the next-generation cloud-native streaming database. Before founding RisingWave Labs, Yingjun worked as a software engineer at Amazon Web Services, where he was a key member of the Redshift data warehouse team. Prior to that, Yingjun was a researcher at the Database group in IBM Almaden Research Center. Yingjun received his PhD from National University of Singapore and was a visiting PhD at the Database Group, Carnegie Mellon University. Besides running RisingWave Labs, Yingjun continues to be passionate about research. He actively serves as a Program Committee member in several top-tier database conferences, including SIGMOD, VLDB, and ICDE. He frequently posts thoughts and observations on the distributed database space on his LinkedIn page.

Related Items:

Is Real-Time Streaming Finally Taking Off?

Using Streaming Data Applications to Power Decision-Making

RisingWave Emerges to Tackle Tsunami of Real-Time Data