What is Stream Processing?

Stream processing is the continuous computation of results from a flow of incoming data, such as sensor readings, application events or network measurements. Instead of waiting for one complete dataset, a processor handles records as the flow progresses, updating outputs or maintaining information needed for later events. Processing can happen record by record or in small groups, depending on the system.
Continuous does not mean instantaneous, and a running processor does not guarantee a complete or current result. Useful stream processing needs clear rules for time, ordering, state, failures and output updates, especially when events arrive late or are replayed.

The infographic follows the continuing flow through partitioning, computation, event-time handling, recovery and updated results. It shows the responsibilities involved, rather than a promise that each event completes immediately.
How does stream processing work?
Imagine a home lab publishing router measurements to a remote service. A stream processor might filter invalid records, group readings by device, maintain a rolling summary and update an operational dashboard. A separate rule could raise an alert when a defined pattern occurs.
This is one execution approach within a data pipeline. The pipeline also includes collection, transport, storage and delivery to the consumer. A fast computation stage cannot make a dashboard current if its input is delayed or its output has not been published.
Sources, buffers, processors and destinations
A source produces records. A broker or retained log may buffer them and keep enough history for consumers to replay. Processing stages transform individual records or combine information across records. A destination, often called a sink, stores the result or performs a supported output action.
Not every stream requires a distributed broker, and not every source is replayable. A small local process can handle a continuing feed too. The architecture needs to match the required failure handling and workload, rather than adopting a large platform just because the data arrives continuously.
An event should have a defined meaning and schema. For example, a record containing a counter increment is different from a snapshot of the current cumulative counter. Adding those two forms in the same way would produce different results, even with perfect transport and no lost records.
Stateless and stateful operations
A stateless operation can act on an individual record without remembering earlier ones, such as converting units or rejecting an invalid field. A stateful operation retains information, such as a per-device total, recent events needed for a pattern or records awaiting a matching join.
State is part of the result's meaning, not simply a performance cache. Losing a rolling total or restoring it against the wrong input position can change the answer. State also needs limits: continuously accepting new keys or retaining unmatched records indefinitely can exhaust storage.
Stream processing, batch processing and micro-batches
The important distinction is the work being processed and how results progress. Batch and stream processing can use similar transformations, storage systems and programming tools.
Approach | Input boundary | How results progress | Important qualification |
|---|---|---|---|
Batch job | A defined, finite set for that run | The job works towards a completed result | It can run frequently and use parallel workers |
Record-oriented streaming | A continuing flow without a predetermined final dataset | Records update state or outputs as they are processed | Aggregation may still wait for a window or trigger |
Micro-batch streaming | A continuing flow handled in successive small groups | Each group advances the continuing computation | A short group interval is not a guaranteed output latency |
Apache Spark Structured Streaming is an example of a system that can implement streaming through micro-batches. Grouping records internally does not make the whole application a single bounded job. Conversely, repeatedly launching a script does not automatically provide a streaming engine's state and recovery behaviour.
Use batch processing when a defined collection and completion deadline suit the task. Stream processing is useful when results need to keep progressing as new data arrives. The two can work together, with prompt operational updates followed by a controlled historical reconciliation.
Stream processing is also different from playing streamed video. A media player receives a continuing flow for playback; the subject here is computation over records and events. Media systems may use stream processing for their own analytics, but the terms describe different responsibilities.
When is stream processing useful?
Choose it when a progressing result has value before a complete historical dataset is available. Illustrative workloads include:
Maintaining operational summaries while device measurements arrive.
Detecting a defined sequence of events and producing a timely alert.
Updating a search index or derived view as supported change records arrive.
Enriching incoming records with reference data while tracking the reference version used.
The freshness target and failure policy still belong to the application. A quick indication can be useful for monitoring while a later reconciliation provides the reporting record. Do not give those outputs interchangeable meanings.
Which time does a stream processor use?
A single record can have several relevant times. Specify which one drives each calculation rather than treating every timestamp as interchangeable.
Time | What it represents | Example consequence |
|---|---|---|
Event time | When the represented event happened, according to its timestamp | A delayed measurement can still belong to an earlier reporting interval |
Ingestion time | When a specified receiving boundary accepted the record | Useful for measuring arrival delay at that boundary |
Processing time | The processor's clock when an operation runs | A backlog or replay can place work in a later processing-time interval |
Apache Flink's time and watermark explanation illustrates why event time and processing time produce different results. An event-time calculation follows record timestamps; a processing-time calculation follows the executing system's clock.
Event timestamps still need validation. A device clock can be wrong, a timezone can be omitted or a field can accidentally use milliseconds where seconds were expected. A far-future timestamp can also distort a watermark strategy based on the greatest timestamp seen. Define acceptable timestamp ranges and a policy for suspect records.
Use unambiguous timestamps and offsets across UK systems, and choose local calendar boundaries deliberately when a report follows UK civil time. Formatting the same instant as local time does not make an event arrive earlier or correct a device's clock.
Windows, watermarks and late events
A continuing stream does not normally offer a moment when every possible event is available. Windowing groups a finite portion for a calculation. A tumbling window creates adjacent, non-overlapping intervals; a sliding window overlaps intervals; a session window groups activity separated by a specified inactivity gap.
A window definition is separate from a trigger, which decides when to emit a result. A system may publish early output and later corrections. Consumers need to know whether an output is an initial estimate, a replacement or a result treated as final under the configured policy.
A watermark signals event-time progress
A watermark expresses progress or an assumption about how complete the earlier event-time data is. It lets operators decide when to produce results or clean up retained state. It is not, by itself, proof that no older event can arrive.
Watermark generation and propagation are implementation-specific. In a multi-input system, one slow or idle input can hold progress back. Flink provides explicit idleness handling for this situation; excluding an idle input allows progress but does not prove that the source will never resume with older events.
Allowed lateness and retained state are policy choices
Some windowing systems can retain a window after its first result so that eligible late records revise it. After the retention boundary, a record may be dropped, diverted for investigation or handled by a correction process, according to the design.
Flink's event-time window API is a concrete example: allowed lateness and triggers affect state retention and possible late firings. A revised result needs to be treated as an update to an earlier calculation. Appending every revision and adding them together can double-count the same underlying work.
Worked example: why one window can report 10, then 15
Techie Broadband illustration: this deterministic teaching simulation was executed and checked against an independent calculation over all archived records. It is our own integer-second policy, not a claim to have run Flink, Kafka or a production monitoring service.
All events have unique identifiers, the same key and an additive value. Focus on the one-minute event-time interval from 10:00:00 inclusive to 10:01:00 exclusive. The event at exactly 10:01:00 would belong to the next interval.
The model sets its watermark to the greatest event timestamp seen minus 20 seconds, advancing it after each arrival. It first emits a window when the watermark reaches its end. It retains that window for revisions until the watermark reaches 30 seconds beyond the end, then removes its active state. An eligible late update emits a replacement immediately.
Arrival and value | Event time | Watermark after arrival | Effect on the first window |
|---|---|---|---|
A adds 4 | 10:00:10 | 09:59:50 | Accumulate 4; no result yet |
B adds 6 | 10:00:50 | 10:00:30 | Accumulate 10; no result yet |
C adds 8 | 10:01:25 | 10:01:05 | C belongs to the next window; first window emits 10 |
D adds 5 | 10:00:40 | 10:01:05 | Late but retained; replace first result with 15 |
E adds 1 | 10:02:00 | 10:01:40 | E belongs to another window; first window's active state expires |
F adds 7 | 10:00:20 | 10:01:40 | Too late for this online window; divert F to a separate ledger |
The first result is 4 plus 6, giving 10. D revises it to 4 plus 6 plus 5, giving 15. F arrives after the chosen retention boundary. A later reconciliation of the archived first-window events gives 4 plus 6 plus 5 plus 7, or 22 across four records.
No duplicate input is needed to produce these different totals. They describe different completeness points under the stated policy. If a consumer adds the initial 10 and replacement 15, it gets 25, which is neither the intended online total nor the archived total.
The model deliberately leaves wall-clock arrival times unspecified and advances event time only when a new maximum timestamp arrives. It therefore does not predict how many real seconds the result takes, or guarantee that every later window will emit when the input becomes idle. Actual engines have their own timestamp precision, trigger and boundary rules.
The practical decision is what the application should do with F. Silently ignoring it, publishing a visibly revised historical result and sending it for separate reconciliation are different contracts. Choose and test that contract before describing the first output as final.
Keys, partitions and ordering
Grouping by a key, such as device identifier, lets a stateful computation maintain related records together. This can distribute independent work across workers, but an unusually busy key can still overload one part of the computation. Adding more workers does not automatically divide one key's ordered state updates.
Kafka retains ordered partition logs with positions called offsets. That is not the same as a global event-time order across every partition or producer. Two devices can report in different orders, and replay follows the retained input history rather than repairing an incorrect source timestamp.
The Kafka design documentation explains partition positions, replay and the coordination needed between consumed inputs and produced outputs. The required ordering scope should be explicit: per device, per account, per partition or across a wider application relationship.
Network ordering is another layer. TCP provides ordered bytes within a connection, but that does not establish the business order of records created by different devices or sent through different connections. Application retries, partitioning and event timestamps remain relevant even when the transport is working correctly.
Joins and state retention need boundaries
A streaming join may need to wait for related records from another input. Define the matching key, time interval, acceptable delay and treatment of unmatched data. A missing counterpart should not create an unlimited store of waiting records.
Likewise, a duplicate-detection store needs a retention policy. Once an old identifier has been forgotten, detecting a much later replay may require another mechanism. Keeping state for less time saves resources but can change the range of histories the application handles correctly.
What does exactly-once processing guarantee?
Delivery, state updates and externally visible actions are different boundaries. At-most-once behaviour can omit work after a failure. At-least-once behaviour can repeat attempts. Exactly-once semantics coordinate a defined processing result so that retries do not multiply its intended effect within the supported boundary.
That does not mean every function physically executes once. Nor does it mean every very late event is included. Read the source, processor and destination guarantees together, including the required configuration and failure assumptions.
Google's Dataflow exactly-once guidance explicitly distinguishes processing results from external side effects. A remote service call made inside user code may repeat unless the destination participates in the relevant coordination or deduplication scheme.
For example, updating a supported transactional output is different from sending an email and then recording progress. If the acknowledgement is lost after the email was sent, retrying can send another. Use stable logical identifiers and a supported output mechanism appropriate to the action; an “exactly once” label on one component is insufficient evidence for the complete workflow.
Checkpoints, replay and recovery
A checkpoint captures recovery state together with the relevant positions in the input. Restoring the state and replaying from compatible positions can recover the continuing computation. A saved offset alone cannot reconstruct a lost running aggregate unless the earlier data is replayed or the state is restored separately.
Flink's checkpointing documentation requires suitable durable input history and state storage for its recovery mechanism. Connector support, configuration and retained history matter. A running process or a configured checkpoint interval does not prove that a recent, usable checkpoint exists.
Test whether checkpoints complete, how long restoration takes and how the destination handles output around the failure boundary. Retention must cover the recoverable positions the design depends on. A checkpoint that refers to input already removed by the source may not provide the expected recovery path.
Replaying history can also change results if reference data, transformation code or external lookup responses have changed. Record versions and define whether a replay should reproduce the earlier result or calculate a corrected one. These are separate operational goals.
Throughput, backpressure and UK broadband constraints
A stream has to keep pace with incoming work over the relevant period. If arrival demand persistently exceeds sustainable processing or output capacity, queued work and result age grow. Temporary bursts can be buffered only within the available storage, retention and recovery policy.
Backpressure is a mechanism by which a slower downstream stage constrains upstream progress. An upstream task showing backpressure may be waiting for a destination that cannot consume quickly enough, rather than being the original bottleneck. Inspect the path to the sink before increasing every worker count.
For a UK home lab sending events to remote processing, upload speed and connection stability can delay ingestion. An outage may produce a burst of older events after reconnection if the local producer retains them. If it does not retain them durably, automatic replay should not be assumed.
More bandwidth can help when the transfer path is the constraint, but cannot repair an overloaded sink, a stalled watermark or a hot key. Encryption, message sizes, shared traffic and per-record overhead also affect useful progress.
Measure the delay from the relevant start event to the usable result. Broker lag, processing duration, watermark delay and dashboard refresh age describe different parts of the path. A low ping or successful speed test cannot establish that the consumer sees a timely, complete result.
How to diagnose a stream that is delayed or wrong
Start by separating input progress, event-time progress, state recovery and output visibility. A job can be running and consuming records while a particular window or destination remains stuck.
Observation | Likely area to investigate | Useful next evidence |
|---|---|---|
Input lag grows continuously | Demand exceeds a processing, storage or output bottleneck | Per-stage throughput and the age of unfinished records |
Records flow but a window does not emit | Watermark, trigger, timestamp or idle-input policy | Watermarks for each active input and the chosen window boundary |
One worker is much busier | Uneven key distribution or expensive records | Per-key or per-partition workload evidence |
Totals rise unexpectedly after restart | Repeated output or incompatible state/input recovery | Checkpoint positions, logical event IDs and destination commits |
Totals change after late arrivals | Expected revisions or an incorrect output contract | Window identity, result version and accepted-lateness policy |
Processor output is current but dashboard is stale | Sink, publication, caching or refresh delay | The stored output version and the consumer's actual read path |
Useful monitoring evidence includes:
Event identifiers, schema versions and validated timestamps, without exposing sensitive payloads unnecessarily.
Per-partition input progress, throughput, watermark progress and late or rejected record counts.
State size, key distribution and checkpoint age, duration and failure status.
Output versions, repeated-attempt handling and the age of the result visible to the consumer.
Set alerts for missing progress and stale results as well as explicit exceptions. A source that silently stops producing can leave old data looking healthy unless freshness is part of the check.
Security, compatibility and operating costs
Protect producers, brokers, processors, checkpoint stores and sinks as separate access boundaries. Use supported encryption, authenticated identities and appropriate permissions. A durable event log or checkpoint may contain data long after it disappears from a dashboard, so retention and access controls need to cover those stores too.
Validate schema changes across producers, processors and consumers. A field that changes meaning can produce a plausible but wrong aggregate without causing a parser failure. Test upgrades against retained historical records as well as newly produced examples.
Operational costs include continuously available compute, buffered input, state, checkpoint storage, network traffic and replay after failure. Streaming is not automatically cheaper or faster for every workload. If a report is only useful once a day, a bounded job may be easier to operate and verify.
How to validate a stream-processing design
Define the result and its timing requirements first, then exercise the conditions that can change it in an appropriate test environment.
Specify each event's identity, schema, timestamp meaning and required ordering scope.
Define windows, triggers, lateness, state retention and whether outputs are replacements or additional records.
Feed known records in order, out of order and after the retention boundary, then check the expected outputs.
Test idle inputs, a busy key and a slow destination while observing lag, watermarks and state growth.
Restart processing around a completed output and a checkpoint, checking state, replay and external side effects.
Verify the actual consumer's result and age, then document the correction and recovery procedures.
The Techie Broadband terminology guide connects the networking and reliability concepts behind the workload. Keep transport health, processing progress and application correctness separate when deciding what a test has established.
Key takeaway
Stream processing keeps a computation moving as events arrive. Trustworthy results depend on more than speed: timestamp meaning, window policy, retained state, ordering scope and coordinated output all matter. Decide when an answer can change, what happens to late events and how replay affects the destination. Then test the result through the consumer's actual path.
Frequently asked questions
Is stream processing always real time?
No. It processes a continuing flow, but transport, buffering, windows, computation and output delivery introduce delay. A real-time requirement needs a defined deadline and evidence that the complete system meets it.
Is stream processing the same as video streaming?
No. Stream processing computes results from records or events. Video streaming delivers media for playback, although a media service may also use event processing for monitoring or analytics.
Can stream processing use batches?
Yes. A continuing streaming application can process incoming records in successive micro-batches. The overall input and recovery model matter as well as whether individual records are grouped internally.
What is a watermark in stream processing?
A watermark signals event-time progress under a defined strategy. Operators can use it to emit results or clean up state. It is not an unconditional guarantee that an older event can never arrive.
Why can a streaming result change later?
An early result may be revised when eligible late records arrive. The window, trigger, retention and output policies determine which updates are accepted and how consumers should interpret the replacement result.
Does exactly-once processing prevent duplicate emails or API calls?
Not automatically. The guarantee applies to a defined processing boundary. External actions need compatible coordination or deduplication, and repeated execution can still occur during recovery even when internal results are committed once.

