Graph
Spark Structured Streaming

⚡Spark Structured Streaming

NEW

A scalable, fault-tolerant stream processing engine in Apache Spark using declarative DataFrame/Dataset APIs and event-time semantics.

DESCRIPTION

Structured Streaming builds on Spark SQL to process data streams as unbounded tables, enabling incremental queries with familiar DataFrame operations. It supports event-time processing, watermarks, windowed aggregations, and stateful computations. Micro-batch and continuous execution modes provide flexibility, with checkpointing ensuring exactly-once or at-least-once semantics depending on sink. Integration with sources like Kafka, files, and sockets simplifies ingestion. Its declarative model aids maintainability and performance tuning for production pipelines.

ALTERNATIVE DEFINITIONS

Apache Spark

Structured Streaming is a scalable and fault-tolerant stream processing engine built on the Spark SQL engine.

Core positioning in Spark SQL with scalability and fault tolerance.

Source

Databricks

Structured Streaming treats a stream as an unbounded table to which new rows are appended, enabling incremental query computation.

Clarifies the unbounded table abstraction and incremental computation model.

Source

Apache Spark DataFrame API Micro-batch Event Time Watermarking Stateful Aggregation Exactly-Once Semantics Checkpointing Apache Kafka Windowed Operations

COMPETING TERMS

Apache Flink Kafka Streams

RELATIONS

KNOWLEDGE AREAS

Real-time & Streaming Data Data Engineering Platform & Tooling Cloud Data Storage & Operations

TARGET AUDIENCE

Data Engineer MLOps Engineer Cloud Architect Software Developer Data Architect DevOps Engineer

EXTERNAL SOURCES

TOP QUESTIONS

What execution modes does Spark Structured Streaming support?

Micro-batch is standard; continuous processing is experimental in some versions, trading latency for constraints.

Category: Definition

How does event-time work in Spark Structured Streaming?

Event-time fields drive windowing and watermarks to handle out-of-order data robustly.

Category: Concept

What are common mistakes with Structured Streaming?

Ignoring watermark configuration, mismanaging state size, and skipping checkpointing can cause correctness and performance issues.

Category: Mistakes

How to achieve exactly-once semantics in Spark Structured Streaming?

Use idempotent sinks or transactional sinks and proper checkpointing to avoid duplicates.

Category: Requirements

Is Spark Structured Streaming suitable for low-latency millisecond pipelines?

It excels at seconds-level latency; sub-100ms pipelines may favor Flink or specialized systems.

Category: Opinion

What’s the risk of large stateful aggregations?

Unbounded state can cause memory pressure and failures; use timeouts, aggregation design, and monitoring.

Category: Risk

How to monitor Spark Structured Streaming in production?

Track batch durations, state store metrics, input rates, and handle alerting via Spark metrics and external APM.

Category: Management

What sources and sinks integrate with Structured Streaming?

Kafka, files, sockets, Delta Lake, and JDBC are common; custom sources support broader ecosystems.

Category: Overview

How do watermarks affect late data?

Watermarks bound how long the engine accepts late events for windowed aggregations before discarding them.

Category: Concept