Cloud concept · Updated

Stream Processing - Stream processing continuously or incrementally computes results from an ongoing flow of data without waiting for the full dataset to arrive.

In short

Stream processing turns incoming events or changes into filtered records, rolling metrics, alerts, or updated tables. It matters when data must be available sooner than a scheduled batch can deliver it, but that freshness comes with decisions about late data, recovery, and duplicate writes.

Cloud Concepts Hub →

5 key aspects of Stream Processing

A reliable streaming design balances freshness with event-time correctness, bounded state, recoverable progress, and sustainable throughput.

01
Incremental processing

Process newly available files, events, or database changes instead of rescanning all historical data on every run. Choose per-record execution or micro-batches according to the freshness target and the overhead of writes.

02
Event time and late data

Use event timestamps when results must reflect when activity occurred. Define windows and a late-data policy so consumers know whether published results can change.

03
Keyed state

Keep state by key for rolling aggregates, deduplication, or joins across events. Set time or retention bounds where the use case permits so state does not grow indefinitely.

04
Checkpointing and replay

Persist source progress and processing state to recover after failures. Retain source data long enough to replay it and use idempotent writes or a transactional sink when duplicate effects are unacceptable.

05
Partitioning and throughput

Partition by a key that preserves the ordering the application needs while distributing work. Monitor processing lag and uneven key traffic, since adding workers may not help if one partition is saturated.

Cloud services for Stream Processing

Azure Event Hubs can buffer incoming events while Azure Databricks or Azure Stream Analytics processes them. Azure Databricks is a fit when the pipeline needs Spark transformations and incremental Delta table writes; Azure Stream Analytics offers managed SQL queries for use cases such as rolling metrics. Amazon Managed Service for Apache Flink and Google Cloud Dataflow provide processing options in their respective clouds; they are alternatives, not stages that need to run together. In any deployment, align source retention with the recovery window and confirm that the destination can handle replay without duplicating results.

Azure Databricks

Azure Databricks runs Apache Spark Structured Streaming workloads that transform incoming records and write incrementally to destinations such as Delta tables. Auto Loader can discover newly arrived cloud storage files and feed them into a streaming query.

Azure Stream Analytics

Azure Stream Analytics runs managed SQL-based streaming queries for filtering, joining, and windowed aggregation. It can read from Azure Event Hubs and route results to downstream stores or streams.

Amazon Managed Service for Apache FlinkAmazon Managed Service for Apache Flink

This service runs Apache Flink applications for stateful processing. Applications can consume from sources such as Amazon Kinesis Data Streams, perform event-time calculations, and write results to downstream systems.

Event Hubs

Azure Event Hubs provides a partitioned event log from which consumers can read independently and replay retained data. It supplies events to stream processors rather than performing the transformations itself.

What is Stream Processing

2 min read

Stream processing treats input as an ongoing sequence rather than a dataset with a known end. A job reads from sources such as an event log, a database change feed, or newly arrived files in object storage. It can validate records, transform fields, join related events, or compute aggregates before writing results to a table, another event stream, or a serving database. A broker can buffer events and make them available for replay, but storing and forwarding events is not the same as processing them.

Choose between batch and streaming based on how soon downstream consumers need usable data, how the source exposes changes, and what the destination can guarantee. A nightly finance report that depends on a closed accounting period is usually simpler to load as a bounded batch. An inventory table that needs to reflect sales within seconds is a better fit for a stream of database changes. An initial batch snapshot followed by streaming changes can cover both needs; record a consistent change-log position for the snapshot and coordinate the handoff so changes are not missed or counted twice. Streaming is not necessarily one event at a time: a micro-batch engine processes small groups of new records while retaining progress across groups.

For time-based calculations, distinguish event time, when something happened, from processing time, when a worker handles it. A five-minute count of sensor readings usually belongs to the time the sensors recorded them, even if a device reconnects and uploads late. A watermark estimates how far event time has advanced and helps the engine decide when to close windows or discard old state. Allowing more lateness can improve completeness, but it keeps state longer and may delay final results. Decide whether events that arrive beyond the allowed lateness should be dropped, tracked separately, or reconciled later.

Recovery depends on both the processing engine and the destination. A checkpoint can record source positions and computation state so the job can resume, but it does not by itself prevent duplicate writes to an external system. If a worker writes an event and fails before recording its progress, it may replay the event. For example, a destination that upserts by stable event ID can make a replay harmless. For a table that stores the latest row per entity, also compare source versions or sequence numbers so an older replay cannot overwrite a newer value.

Streaming does not guarantee immediate results or global event order. End-to-end freshness depends on buffering, trigger intervals, computation, and destination write latency. In partitioned streams, ordering is typically guaranteed only within a partition, and a heavily used key can overload one worker even when others have spare capacity. Monitor the age of unprocessed events, checkpoint health, and state growth against the freshness target. If hourly updates already meet that target, a scheduled incremental batch can offer simpler recovery and lower operating cost.

Stream Processing exam questions

Real practice exam questions on Stream Processing, with the correct answer and its explanation. Answer them with every option in the exam simulator.

DVA-C03

A concert venue's ticketing service and payment service publish reservation and payment confirmation events to separate Amazon Kinesis data streams. Both event types include a reservation ID. The venue must publish a ticket-ready event within seconds after both records have been read, regardless of which record arrives first. Matching records can reach the consumer several minutes apart, and the consumer can discard an unmatched record after 10 minutes. The team does not want to maintain a separate database for pending records. Which solution meets these requirements?

Show answerCORRECT ANSWER

Use Amazon Managed Service for Apache Flink to read both streams and key both inputs by reservation ID. Keep the first record in keyed state, emit the ticket-ready event when the matching record arrives, and use a timer to clear unmatched state after 10 minutes.

Keyed state brings both event types for a reservation together and retains the first record across arrivals without a separate database. The application can emit as soon as the second record arrives, while a timer bounds how long unmatched records remain in state.

Practice Stream Processing in a full exam

Questions on Stream Processing in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

Learn Stream Processing in lessons

2 short lessons on Stream Processing in 1 certification course.

Open the lessons