Data Streaming

Data streaming is the continuous flow of data as it's generated by various sources. Instead of processing data in large "batches" at the end of the day, streaming allows for processing "in-flight".


1. Streaming for Clients (SSE & Media)

Server-Sent Events (SSE)

A unidirectional communication method where a server can push data to a client over HTTP.

Media Streaming (HLS / DASH)

Breaking media files (video/audio) into small chunks (2-10 seconds long). The client downloads these chunks sequentially.


2. Streaming for Systems (Event Streaming)

In distributed systems, streaming refers to the continuous ingestion and processing of event logs.

Key Concepts


Batch vs. Stream Processing

Feature Batch Processing Stream Processing
Data Size Large, finite datasets Infinite streams
Latency High (mins/hours) Very Low (ms/seconds)
Complexity Simple High
Use Case Billing, Monthly reports Stock trading, Fraud detection

Common Streaming Architecture

graph LR
    P[Event Producers] --> Broker[Message Broker / Log]
    Broker --> Processor[Stream Processor]
    Processor --> Sink[Database / Analytics]
    
    subgraph "Stream Processing Layer"
        Broker
        Processor
    end

Popular Technologies


Key Takeaway

Streaming is about freshness. If your business needs to react to data within seconds (e.g., alerting when a server's CPU is 99% or detecting a stolen credit card), you need a streaming architecture. If you can wait until the next day, stick to batch processing.