Apache Spark™ Structured Streaming has lengthy powered mission-critical pipelines at scale, from streaming ETL to close real-time analytics and machine studying. Now, we’re increasing that functionality to a wholly new class of workloads with real-time mode, a brand new set off kind that processes occasions as they arrive, with latency within the tens of milliseconds.
In contrast to current micro-batch triggers, which both course of information on a set schedule (ProcessingTime set off) or course of all obtainable information earlier than shutting down (AvailableNow set off), real-time mode constantly processes information and emits outcomes as quickly as they’re prepared. This allows ultra-low-latency use instances like fraud detection, reside personalization, and real-time machine studying characteristic serving, all with out altering your current code or replatforming.
This new mode is being contributed to open supply Apache Spark and is now obtainable in Public Preview on Databricks.
On this submit, we’ll cowl:
- What real-time mode is and the way it works
- The sorts of functions it allows
- How one can begin utilizing it as we speak
What’s real-time mode?
Actual-time mode delivers steady, low-latency processing in Spark Structured Streaming, with p99 latencies as little as the single-digit milliseconds. Groups can allow it with a single configuration change — no rewrites or replatforming required — whereas retaining the identical Structured Streaming APIs they use as we speak.
How real-time mode works
Actual-time mode runs long-lived streaming jobs that schedule levels concurrently. Information passes between duties in reminiscence utilizing a streaming shuffle, which:
- Reduces coordination overhead
- Removes the fastened scheduling delays of micro-batch mode
- Delivers constant sub-second efficiency
In Databricks inner assessments, p99 latencies ranged from a couple of milliseconds to ~300 ms, relying on transformation complexity:
Functions and Use Circumstances
Actual-time mode is designed for streaming functions that require ultra-low-latency processing and speedy response occasions, typically within the important path of enterprise operations.
Actual-Time Mode in Spark Structured Streaming has delivered outstanding ends in our early testing. For a mission-critical funds authorization pipeline, the place we carry out encryption and different transformations, we achieved P99 end-to-end latency of simply 15 milliseconds. We’re optimistic about scaling this low-latency processing throughout our information flows whereas constantly assembly strict SLAs. — Raja Kanchumarthi, Lead Information Engineer, Community Worldwide

Along with Community Worldwide’s cost authorization use case quoted above, a number of early adopters have already used it to energy a variety of workloads:
Fraud detection in monetary companies: A worldwide financial institution processes bank card transactions from Kafka in actual time and flags suspicious exercise, all inside 200 milliseconds – lowering threat and response time with out replatforming.
Customized experiences in retail and media: An OTT streaming supplier updates content material suggestions instantly after a consumer finishes watching a present. A number one e-commerce platform recalculates product provides as prospects browse – retaining engagement excessive with sub-second suggestions loops.
Stay session state and search historical past: A significant journey website tracks and surfaces every consumer’s current searches in actual time throughout units. Each new question updates the session cache immediately, enabling customized outcomes and autofill at once.
Actual-time ML Characteristic Serving: A meals supply app updates options like driver location and prep occasions in milliseconds. These updates circulate straight into machine studying fashions and user-facing apps, bettering ETA accuracy and buyer expertise.
These are just some examples. Actual-time mode can help any workload that advantages from turning information into selections in milliseconds, from IoT sensor alerts and provide chain visibility to reside gaming telemetry and in-app personalization.
Getting Began with real-time mode
Actual-time mode is now obtainable in Public Preview on Databricks. In case you’re already utilizing Structured Streaming, you possibly can allow it with a single configuration and set off replace – no rewrites required.
To strive it out in DBR 16.4 or above:
- Create a cluster (we advocate Devoted Mode) on Databricks with Public Preview entry.
-
Allow real-time mode by setting the next Spark configuration:
-
Use the brand new set off in your question:
Checkpointing
The set off(RealTimeTrigger.apply(...)) choice allows the brand new real-time execution mode, permitting you to realize sub-second processing latencies. RealTimeTrigger accepts an argument that specifies how often the question checkpoints. For instance, set off(RealTimeTrigger.apply(“x minutes”)) By default, the checkpoint interval is 5 minutes, which works effectively for many use instances. Lowering this interval will increase checkpoint frequency, however could influence latency. Most streaming sources and sinks are supported, together with Kafka, Kinesis, and forEach for writing to exterior programs.
Abstract
Actual-time mode is good to be used instances that demand the bottom attainable latency. For a lot of analytical workloads, customary micro-batch mode could also be less expensive whereas nonetheless assembly latency necessities. Actual-time mode introduces slight system overhead, so we advocate utilizing it for latency-critical pipelines equivalent to these examples above. Assist for extra sources and sinks is increasing, and we’re actively working to broaden compatibility and additional cut back latency.
For extra particulars, please evaluate the real-time mode documentation for full implementation particulars, supported sources and sinks, and instance queries. You’ll discover all the pieces you must allow the brand new set off and configure your streaming workloads.
For a broader have a look at what’s new in Apache Spark 4.0, together with how real-time mode suits into the evolution of the engine, watch Michael Armbrust’s Spark 4.0 keynote from DAIS 2025. It covers the architectural shifts behind Spark’s subsequent chapter, with real-time mode as a core a part of the story.
To go deeper on the engineering behind real-time mode, watch our engineers’ technical deep dive session, which walks by way of the design and implementation.
And to see how real-time mode suits into the broader streaming technique on Databricks, take a look at the Complete Information to Streaming on the Information Intelligence Platform.
