cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

streaming vs batch, unbounded vs bound

jonxu
New Contributor III

Any one can help me understand why cannot we unify streaming with batch and unbounded with bounded, if we regard the streaming/unbounded as mini-version of batch/bounded, please?

i.e., if I set one second as the frequency for batch processing, will it be the same as streaming, please?

 

1 ACCEPTED SOLUTION

Accepted Solutions

VZLA
Databricks Employee
Databricks Employee

This could be a very long thread, but to summarize it we could refer to the improvements or streaming specific features to understand why these two are not the same, and why these features were created. Essentialy, Spark streaming(unbounded) jobs are fundamentally different from high-frequency batch jobs(bounded), so it’s not as simple as treating streaming as "tiny batches". Why?:

  1. Structured Streaming API: Spark has an API just for streaming, designed to handle continuous, real-time data without waiting for entire datasets like batch jobs do. Reaching this level of improvement and difference by self implementing them in a batch job, would require a lot of end user job (not worth it)

  2. Micro-Batch Execution: Structured Streaming processes data in near-instant “micro-batches,” starting processing as soon as data arrives, which a high-frequency batch job can’t do effectively.

  3. Event Time & Watermarking: Unlike batch jobs, Spark streaming can work with event time and uses watermarks to handle late data and out-of-order events accurately.

  4. Stateful Processing: Streaming can track and hold state across micro-batches for long-running aggregations, which batch jobs lack without constant workarounds.

  5. Continuous Processing Mode: Spark offers experimental continuous processing for true real-time execution, which batch jobs can’t replicate since they rely on periodic scheduling.

  6. Exactly-Once Fault Tolerance: Streaming jobs use checkpoints to achieve exactly-once processing, ensuring data accuracy even if a failure happens mid-stream.

  7. Trigger Control: In streaming, triggers manage when to process data based on data arrival, while batch jobs would require custom scheduling logic to even come close.

So, streaming isn’t exactly “mini-batch” — it’s purpose-built for handling unbounded data with real-time constraints.

https://youtu.be/i31QggFi4mo?feature=shared&t=794

Hope it helps.

View solution in original post

Databricks is a leading big data processing service available on Azure. One of the nicest features in Databricks is the ability to develop workloads that run in batch or streaming modes. In this webinar, we'll review the basics of a notebook running in batch mode. In this example, we'll be ...
2 REPLIES 2

VZLA
Databricks Employee
Databricks Employee

This could be a very long thread, but to summarize it we could refer to the improvements or streaming specific features to understand why these two are not the same, and why these features were created. Essentialy, Spark streaming(unbounded) jobs are fundamentally different from high-frequency batch jobs(bounded), so it’s not as simple as treating streaming as "tiny batches". Why?:

  1. Structured Streaming API: Spark has an API just for streaming, designed to handle continuous, real-time data without waiting for entire datasets like batch jobs do. Reaching this level of improvement and difference by self implementing them in a batch job, would require a lot of end user job (not worth it)

  2. Micro-Batch Execution: Structured Streaming processes data in near-instant “micro-batches,” starting processing as soon as data arrives, which a high-frequency batch job can’t do effectively.

  3. Event Time & Watermarking: Unlike batch jobs, Spark streaming can work with event time and uses watermarks to handle late data and out-of-order events accurately.

  4. Stateful Processing: Streaming can track and hold state across micro-batches for long-running aggregations, which batch jobs lack without constant workarounds.

  5. Continuous Processing Mode: Spark offers experimental continuous processing for true real-time execution, which batch jobs can’t replicate since they rely on periodic scheduling.

  6. Exactly-Once Fault Tolerance: Streaming jobs use checkpoints to achieve exactly-once processing, ensuring data accuracy even if a failure happens mid-stream.

  7. Trigger Control: In streaming, triggers manage when to process data based on data arrival, while batch jobs would require custom scheduling logic to even come close.

So, streaming isn’t exactly “mini-batch” — it’s purpose-built for handling unbounded data with real-time constraints.

https://youtu.be/i31QggFi4mo?feature=shared&t=794

Hope it helps.

Databricks is a leading big data processing service available on Azure. One of the nicest features in Databricks is the ability to develop workloads that run in batch or streaming modes. In this webinar, we'll review the basics of a notebook running in batch mode. In this example, we'll be ...

jonxu
New Contributor III

Many thanks for the clarification!

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now