7 Minutes to Understand the New Spark Streaming Feature that Changes Everything
Summary
Apache Spark has introduced a new Real-Time Mode (RTM) for Structured Streaming, aiming to achieve millisecond-level latency comparable to Apache Flink. Traditionally, Spark Structured Streaming processes data in micro-batches, leading to higher latency than Flink's true continuous stream processing. The new RTM, released with Spark 4.1 on December 16, 2025, addresses these limitations by continuously consuming fresh data in longer-running batches (default 5 minutes), scheduling all processing stages concurrently instead of sequentially, and utilizing an in-memory streaming shuffle for faster data exchange between stages. Additionally, RTM employs a modified checkpointing strategy that occurs at the end of batch processing, offering a trade-off between recovery speed and overhead. This enhancement allows existing Spark users to achieve lower latency with minimal code changes, primarily by switching to a RealTimeTrigger.
Key takeaway
For data engineers and architects evaluating stream processing solutions, Spark Structured Streaming's new Real-Time Mode offers a compelling alternative to Flink for millisecond-latency use cases. You should investigate RTM to potentially consolidate your streaming infrastructure within the Spark ecosystem, reducing the operational complexity and learning curve associated with managing a separate Flink deployment. This update significantly alters the landscape for choosing a stream processing engine.
Key insights
Spark Structured Streaming's new Real-Time Mode achieves millisecond latency by optimizing data consumption, stage scheduling, and data shuffling.
Principles
- Concurrent stage execution reduces latency overhead.
- In-memory data exchange accelerates shuffle operations.
- Checkpointing strategy impacts recovery and latency.
Method
Real-Time Mode continuously reads fresh data, schedules all processing stages concurrently, and uses an in-memory streaming shuffle for inter-stage data transfer, with checkpointing at batch end.
In practice
- Switch to RealTimeTrigger for lower latency.
- Evaluate RTM for Flink-tier latency needs.
- Consider checkpointing frequency for recovery vs. latency.
Topics
- Apache Spark
- Stream Processing
- Real-time Mode
- Low Latency
- Data Engineering
Best for: CTO, VP of Engineering/Data, AI Architect, Data Engineer, MLOps Engineer, AI Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Modern Data 101.