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 II

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 II

Many thanks for the clarification!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group