Stream processing (also known as event stream processing, data stream processing, or distributed stream processing) is a programming paradigm in computer science that views streams—sequences of events in time—as the central input and output objects of computation. It encompasses dataflow programming, reactive programming, and distributed data processing. Stream processing systems use streaming algorithms to trace parallel processing for data streams.
Overview
Stream processing simplifies parallel software and hardware by restricting the kinds of parallel computation that can be performed. Given a sequence of data (a stream), a series of operations (kernel functions) is applied to each element in the stream. Kernel functions are usually pipelined, and efficient local on-chip memory reuse is attempted in order to minimize bandwidth loss associated with external memory interaction. Uniform streaming, in which a single kernel function is applied to all elements in the stream, is typical.
Because the kernel and stream abstractions expose data dependencies, compiler tools can fully automate and optimize on-chip management tasks. Stream processing hardware can use techniques such as scoreboarding to initiate direct memory access (DMA) when dependencies are resolved.
Applications
Stream processing is especially suitable for applications that exhibit three characteristics:
- Compute intensity: The number of arithmetic operations per I/O or global memory reference is high (often over 50:1 in signal processing).
- Data parallelism: The same function is applied to all records of an input stream, allowing multiple records to be processed simultaneously.
- Data locality: Data is produced once, read once or twice later, and then not used again.
Examples include graphics rendering (each record is a vertex with normal and color information), image processing (each record is a pixel), video encoding (each record is a macroblock), and wireless signal processing (each record is a sequence of antenna samples).
Comparison to Prior Parallel Paradigms
Traditional CPUs use a single instruction, single data (SISD) architecture. As computing demands grew, parallel execution approaches emerged:
- SIMD (Single Instruction, Multiple Data): One instruction operates on multiple data elements simultaneously, often implemented via SIMD within a register (SWAR).
- MIMD (Multiple Instruction, Multiple Data): Separate execution structures handle distinct instruction streams.
In stream processing, data is treated as an unbounded, continuous sequence of elements rather than a static dataset. Instead of managing iteration explicitly, the program defines a dataflow sequence, allowing the execution environment to apply the compute kernel function automatically as new data elements arrive. Compilers optimized for this paradigm can perform extensive automated code transformations such as loop unrolling, allowing throughput to scale with hardware capacity to enable utilization of hundreds of arithmetic logic units (ALUs).
Data Layout Considerations
Data structure layout significantly impacts execution efficiency. Two common approaches are:
- Array of Structures (AoS): Entities are allocated end-to-end. Processing a single attribute requires skipping over unused attributes, resulting in inefficient cache utilization.
- Structure of Arrays (SoA): Identical fields are isolated into individual, contiguous arrays, optimizing data streaming and vector execution at the cost of potential cache misses when operating on multiple disparate attributes simultaneously.
Contemporary GPUs provide hardware support for attribute slots where developers can format data streams as either AoS or SoA via an explicit stride parameter.
History and Evolution
- 1980s: Stream processing was explored within dataflow programming (e.g., the SISAL language).
- 1985: The Commodore Amiga Blitter provided an early hardware implementation of stream-like data manipulation.
- 1996–2002: The Stanford Imagine Project, funded by DARPA, Intel, and Texas Instruments, pioneered the modern stream architecture.
- 2001–2002: Early vertex programmability was introduced in graphics hardware (ATI R200, Nvidia NV20).
- 2004: Stanford Merrimac extended the Imagine architecture into supercomputing.
- 2006–present: Unified stream architectures merged vertex and pixel pipelines into homogeneous arrays of programmable stream cores, enabling general-purpose GPU computing (GPGPU).
- 2007: Stream Processors, Inc. Storm-1 commercialized the Imagine architecture for digital signal processing.
Processor Architecture Comparison
General-purpose CPUs allocate substantial die area to cache tracking, branch prediction, and speculative execution, with historically less than 10% dedicated to arithmetic logic units. Stream processing hardware minimizes management overhead by leveraging explicit dataflow restrictions. Stream processors typically operate in a co-processing environment where a host CPU handles operating system and resource management while the stream processor focuses on high-throughput arithmetic acceleration.
Stream processors utilize wide, dedicated memory buses and organize execution units into dense parallel arithmetic clusters managed by convergent VLIW and SIMD control paradigms.
Hardware-in-the-Loop Issues
Not all workloads benefit from stream processing. Inter-processor communication latency is a significant bottleneck. The overhead of transferring data between host memory and stream processor memory means that utilizing a stream coprocessor for small datasets is frequently inefficient—a phenomenon known as the short stream effect. Reconfiguring execution state or compiling a new kernel also introduces significant latency.
Major Stream Processing Systems
Distributed and Cloud-Scale Execution
- Native Continuous Processing: Apache Storm, Apache Flink, Apache Samza
- Micro-Batch Processing: Apache Spark Streaming
- Distributed Logging Fabrics: Apache Kafka
Managed Cloud Services
- AWS Kinesis, Google Cloud Dataflow, IBM Streams, Microsoft Azure Stream Analytics, MongoDB Atlas Stream Processing
Complex Event Processing (CEP)
- Apache NiFi, Apama (Software AG), WSO2 Stream Processor / Siddhi
Stream Programming Languages and Libraries
- Academic/Open Source: Brook, StreamIt (MIT), RaftLib (C++), CAL Actor Language, S-Net, ACOTES, BeepBeep
- Commercial/Proprietary: SPADE (IBM System S), RapidMind (acquired by Intel), PeakStream (acquired by Google)
- Vendor-Specific Hardware: CUDA (Nvidia), Brook+ (AMD), Intel Ct