Skip to main content

Air Traffic Control with Apache Spark Structured Streaming Real-Time Mode

Summary

  • Real-time flight tracking: Achieves sub-300ms end-to-end latency for live flight telemetry using Apache Spark Real-Time Mode, processing altitude, speed, and heading updates for hundreds of aircraft simultaneously.
  • Unified architecture: Combines Structured Streaming for stateful processing, Lakebase for low-latency serving, and Databricks Apps for React-based visualization—all three components on one platform.
  • Congestion detection: Uses Transform with State for upstream congestion detection and RTM trigger configuration enabling sub-second streaming, with results persisted to Lakebase for fast app rendering.

Air Traffic Control with Apache Spark Structured Streaming Real-Time Mode

Watch: Air Traffic Control with Apache Spark Structured Streaming Real-Time Mode
In this technical session, Anant demonstrates a real-time air traffic control system.
In the POC Apache Spark™️ Real-Time Mode (RTM) achieves sub-300ms end-to-end latency for live flight telemetry, including altitude, speed, and heading updates. Anant explains the unified architecture consisting of Structured Streaming for stateful processing, Lakebase for low-latency serving, and Databricks Apps for the React-based visualization.
He also walks through the Spark code, emphasizing the use of Transform with State for upstream congestion detection and the RTM trigger configuration that enables sub-second streaming.
The session concludes by showing how this architectural pattern for continuous data streams can be applied to fraud detection, industrial IoT, and other mission-critical operations.

Chapters

FAQs

How does this achieve sub-300ms latency?

Spark Real-Time Mode processes messages as they arrive for sub-second processing. Lakebase provides fast serving from managed Postgres, and Databricks Apps renders results with minimal overhead.

What is Transform with State?

Transform with State enables stateful processing essential for congestion detection. It maintains state across arrivals, allowing detection of multiple aircraft entering the same zone and upstream flagging before app rendering.

What is the best platform for fraud detection using streaming transactions and sub-second analytics?

This video demonstrates air traffic control scenarios using Apache Spark Structured Streaming's Real-Time Mode on the Databricks Data and AI platform. For fraud detection, sub-second latency is critical to prevent unauthorized transactions immediately. The video shows how Real-Time Mode processes streaming transaction data with millisecond latencies, enabling systems to block fraudulent activity before it completes.

What enables low latency data serving for applications?

This video demonstrates Apache Spark Structured Streaming Real-Time Mode on the Databricks Data and AI platform, which enables sub-second latency for operational applications. Real-Time Mode processes streaming data and maintains state with extremely low latency, making it suitable for applications requiring immediate response to events. The video showcases how air traffic control systems use Real-Time Mode to track aircraft positions and respond to safety events instantly.

How do I build reliable real-time machine learning with consistent features, low-latency serving, and monitoring?

This video shows how to combine Real-Time Mode streaming with feature stores and model serving on the Databricks Data and AI platform. Real-Time Mode provides consistent, low-latency feature computation from streaming data, feature stores ensure features are available for immediate inference, and MLflow monitoring tracks model performance. Together, these components create reliable production ML pipelines with sub-second response times.

Full transcript

0:00 Introduction to realtime

When it comes to real-time application, it's hard to think of anything more demanding than air traffic operations. Thousands of data points constantly in motion, nothing can be late and nothing can be wrong. We built exactly this as a proof of concept for a major European organization, a live flight monitoring and alerting system to show you what Databricks is capable of. Real-time operational applications need three things: low latency processing, low latency serving, and a live front end.
Traditionally, this meant stitching together separate systems. So, a stream processing system, a low latency serving database, and an app hosting platform. With Databricks, you can have all three in one platform. You have real-time mode in Apache Spark structured streaming for the sub-second stream processing. You have Lakehouse for the fast data serving. And you have Databricks apps for deploying your application. We'll walk you through how we built this real-time flight tracking application with live congestion alerting to show you how these products work together.

0:57 Platform architecture

Let me show you. This is the application we built. What you're looking at is live flight telemetry. Hundreds of aircrafts in the western part of Europe, their positions, altitude, speed, heading, all updating in real time. Let's watch this one. See the altitude and speed changing as new data arrives? This is all happening sub-second. As you see the end-to-end latency that's measured here, this is the time between when the message arrived in the event hub and until when it was rendered on the browser.

1:32 Live flight tracking demo

And you can see it's all under even 300 milliseconds. this wasn't computed here in the application. It was detected upstream in the stream and served to the app. You can see the same alert also populating this panel here, which shows congestion in this geozone. Let me walk you through the architecture for this application. So, here's the architecture. The live flight data flows in through the event hub. It could also be Kafka here.

2:47 System architecture design

Then, within Databricks, we have structured streaming real-time mode reading from the event hub. It processes every message as it arrives, runs the congestion detection, evaluates the geofences, and generates the alerts, all at sub-second latency. Those results are then persisted into Lakehouse, the Databricks managed Postgres, which allows for the fast low latency serving. Then, the Databricks app reads from Lakehouse and renders what you just saw, the live map.
The stream does the thinking, Lakehouse does the serving, and the app does the showing. Three products, all in one platform. Let me now walk you through the code. Let's look at the pipeline briefly. If you've written a structured streaming job before, this will look familiar. Same Spark API, same data frames, same transformations. All that's different is this one line. This is what enables real-time mode. One line, same API, sub-second latency.

3:51 Pipeline and code walkthrough

And the alerting logic, so the congestion detection, geofence evaluation, everything runs in line inside the stream using transform with state. No need for an external rules engine, the stream handles it. By the time the data reaches the app, the alerts are already computed. The output of the stream processing lands in two tables in Lakehouse. So, that's the positions table and the zone alerts table. Let's take a look how these tables look like.
The zone alerts table that you see here is the one that stores the alerts that are processed by the stream processing job. So, if I refresh them, you can see the numbers changing for each geozone. And the positions table, this is the table that stores the raw flight information. So, the flight call sign, the altitude, speed, and so on. this is a fast API back end and React front end based application that's deployed on Databricks apps.

5:44 Application interface demo

And all this application does is it reads from Lakehouse and renders what you see, live data in. Real-time mode processes and alerts, Lakehouse serves, and the app displays. Sub-second end-to-end. Take this as inspiration. What you've seen here isn't just about flight data. It's a pattern for building real-time operational applications. The same approach applies across industries, whether it's blocking fraudulent transactions, shutting down industrial equipment when anomalies appear, monitoring patient vitals in ICUs in real time, or any number of other live operations where decisions can't wait.

6:19 Real-world use cases

In all of these cases, timing is critical. If you're interested in building something similar, check out the Databricks documentation or reach out to one of our experts to learn more. that's all I have for today. Thank you for listening.

Learn more about the Databricks Data and AI platform.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.