Articles published on this website summarize publicly available information, industry research and educational materials.
Streaming vs Batch Processing
Batch processing handles data in discrete, finite sets — a nightly extraction job that processes the previous day's transactions is a batch process. Streaming processing handles data continuously as it is produced, with each record being processed as it arrives rather than accumulated into a batch first.
The practical distinction lies in latency: batch processing introduces latency proportional to the batch interval (hours to days), while stream processing can achieve latency in the range of milliseconds to seconds. When business processes require low-latency responses to data changes — such as fraud detection, inventory updates, or user behavior analysis — streaming architectures are appropriate. When latency of hours is acceptable and cost efficiency is a priority, batch remains a valid choice.
Streaming Architecture Components
Event Producers
Event producers are the sources of data in a streaming architecture. They may be application services emitting events as a side effect of user actions or system state changes, sensors or IoT devices emitting telemetry, change data capture processes reading from database transaction logs, or batch processes that emit records individually into a stream.
Streaming Platform
The streaming platform receives events from producers, stores them durably, and makes them available to consumers. It manages partitioning of event streams, replication for fault tolerance, and retention of events for the configured period. Apache Kafka is the most widely deployed open-source streaming platform; cloud providers also offer managed streaming services built on or compatible with Kafka's API.
Stream Processors
Stream processors consume events from the streaming platform, apply transformation or analytical logic, and produce output — either back to the streaming platform for further processing or to a destination system. Stream processors can be stateless (processing each event independently) or stateful (maintaining state across events to support aggregations, joins, or pattern detection).
Sink Systems
Sink systems are the destinations for processed stream data. They may include operational databases updated in near real time, analytics databases receiving continuous updates, search indexes, downstream streaming topics, or notification systems.
Stream Processing Concepts
Windowing divides a continuous stream into bounded time intervals for aggregation. Tumbling windows cover non-overlapping fixed-duration periods; sliding windows advance incrementally and can overlap; session windows group events by activity periods separated by inactivity gaps. Choosing the correct windowing strategy depends on the semantics of the aggregation being computed.
Watermarks are a mechanism for handling late-arriving events. Because events may be produced out of order or delayed in transit, stream processors use watermarks to define a point in event time beyond which late events will not be incorporated into a window. Balancing watermark advancement against the risk of late event loss is a practical trade-off in streaming system design.
Delivery Guarantees
Streaming platforms provide different delivery guarantee levels: at-most-once (events may be lost but never duplicated), at-least-once (events will be delivered but may be duplicated), and exactly-once (events are delivered exactly one time, with no loss or duplication). Exactly-once delivery is the most complex to implement and typically requires coordination between the streaming platform and consumer applications, with idempotent consumer logic or transactional message processing.
Deployment Considerations
Self-hosted streaming platforms require management of cluster sizing, partition rebalancing, monitoring, and upgrades. Cloud-managed streaming services reduce this operational burden but introduce dependencies on specific cloud providers, which may affect multi-cloud portability. Organizations with strict data residency requirements should verify where managed services process and store stream data.
Stream processing applications are typically deployed as long-running services rather than batch jobs. Scaling stream processors involves adding partitions to topics and additional consumer instances, with partitioning strategy determining the maximum degree of parallelism.