Streaming is a type of data processing engine that is designed with infinite data sets in mind. Nothing more.

Unlike Batch processing where data is bounded with a start and an end in a job and the job finishes after processing that finite data, Streaming is meant for processing unbounded data coming in realtime continuously for days,months,years and forever. As such, being always meant for up and running, a streaming application is hard to implement and harder to maintain.

Important Aspects of Stream Processing:

  • Delivery Guarantees
  • Fault Tolerance
  • _State Management
  • Performance
  • Advanced Features

Two Types of Stream Processing:

Now being aware of the terms we just discussed, it is now easy to understand that there are 2 approaches to implement a Streaming framework:

Native Streaming:

Also known as Native Streaming.It means every incoming record is processed as soon as it arrives, without waiting for others. There are some continuous running processes (which we call as operators/tasks/bolts depending upon the framework) which run for ever and every record passes through these processes to get processed. Examples : Storm, Flink, Kafka Streams, Samza.

Micro-batching :

Also known as Fast Batching. It means incoming records in every few seconds are batched together and then processed in a single mini batch with delay of few seconds. Examples: Spark Streaming, Storm-Trident.

How Stream Processing Works

The stream processing pipeline follows a systematic flow from data generation to actionable output​

  1. Data Collection - Data is continuously generated from multiple sources including IoT sensors, financial transactions, website analytics, social media platforms, application logs, and connected devices.

  2. Data Ingestion - The incoming data flows immediately into the stream processing engine through message brokers like Apache Kafka without waiting for batches to accumulate.

  3. Real-Time Processing - Each data element is processed immediately upon arrival through operations including filtering, transformation, aggregation, enrichment, and joining with other streams.

  4. State Management - The engine maintains necessary state information to track aggregations, session data, and window information across events.

  5. Output Generation - Processed results are published to downstream systems such as dashboards, databases, alert systems, or message queues.

AspectStream ProcessingBatch Processing
Processing ModelContinuous, event-drivenScheduled, periodic
Data LatencyLow (milliseconds-seconds)High (hours-days)
ThroughputContinuous flowLarge discrete volumes
ComplexityHigher (state management)Lower (simpler logic)
CostHigher (continuous resources)Lower (scheduled resources)
Ideal ForReal-time analytics, monitoringHistorical analysis, reporting

Stream Processing Architectures

  • Lambda Architecture
  • Kappa Architecture

Frameworks

FrameworkLatencyThroughputState MgmtLanguagesExactly-OnceComplexityBest For
Kafka StreamsLowHighGoodJavaYesLowKafka-centric apps
FlinkVery LowVery HighExcellentJava/Scala/PythonYesHighComplex stateful processing
StormVery LowVery HighLimitedMultipleLimitedMediumLow-latency analytics
SamzaLowHighGoodJava/ScalaYesMediumKafka ecosystem
KinesisLow-MediumHighLimitedMultipleLimitedLowAWS ecosystem
DataflowLow-MediumHighGoodJava/PythonYesMediumGoogle Cloud ecosystem