Memgraph
Back to blog
Introduction to Stream Processing

Introduction to Stream Processing

By Memgraph
7 min readFebruary 1, 2022 · Updated November 20, 2026

Stream processing is a way of processing data continuously as it arrives, instead of collecting it first and processing it later in batches. It lets you filter, aggregate, and act on events within milliseconds to seconds. Common uses include fraud detection, monitoring, IoT, and real-time personalization.

What Is Stream Processing?

Stream processing handles data as an unbounded flow of events, such as clicks, payments, log lines, or sensor readings. Each event is processed shortly after it happens, so results stay current.

Computations usually work on a single event or a small window of recent events. For example, a system might count failed logins per user over the last five minutes.

Processing happens asynchronously. Data sources keep producing events without waiting for the processing system to respond.

Stream Processing Infrastructure Overview

Stream processing infrastructure has three main components:

  1. A real-time data source that produces events. Read more about real-time data.
  2. A processing framework that transforms, filters, and aggregates events. See the top streaming analytics tools.
  3. Consumers that use the results, such as dashboards, alerting systems, and applications. Read the guide to real-time analytics.

The processing framework is the brain of this architecture. It decides which events matter, which to discard, and what to do with the rest.

Input data flows into a stream processing engine, which produces analytics and an output stream

Stream Processing vs. Batch Processing

Stream processing evaluates events continuously and incrementally, as they happen. It doesn't wait until all the data is collected before producing a result.

Batch processing collects data over a period and processes it as a group, often at the end of a business cycle. Payroll at the end of the month is a classic example. A batch job runs over a large dataset and reduces it to a smaller set of results.

The two often work together. Streams handle what needs an immediate response, and batches handle large historical analyses. For a deeper comparison, read Batch Processing vs Stream Processing.

Stream Processing Examples and Use Cases

Security Monitoring With Kafka

In most stream processing use cases, an activity generates event data, and some action should follow right away.

Imagine 100 microservices, each publishing information about who is using it and how it's performing. Each service writes these events to an Apache Kafka topic, so the data flows into Kafka continuously and in real time.

The security team needs to analyze this data and spot problems. A processing framework, such as Apache Flink, Apache Spark, Apache Beam, or Kafka Streams, consumes the topic in real time. It filters out most of the noise and publishes only the events that need action to a new topic. With Kafka Streams, for example, the processing logic runs inside your application and keeps its own local state store.

Other applications consume those events and act on them, for example, by sending alerts or shutting down a compromised system. This chain of producing, processing, and acting on events is called a stream processing pipeline.

Memgraph can consume the same Kafka topic directly and build a graph of which services, users, and IP addresses interact. That makes it easier to see how a suspicious event connects to the rest of the system.

A writer app sends events to a Kafka topic, and a Kafka Streams topology with a state store processes them for reader apps

Real-Time Analytics on AWS

Imagine streaming data sources, such as mobile apps, websites, and IoT devices, that capture user activity. They send events to Amazon Kinesis Data Streams, a streaming service similar to Kafka.

From there, the data can take several paths:

  • Amazon Data Firehose delivers it to storage and search services, such as an Amazon S3 data lake or Amazon OpenSearch Service.
  • Amazon Managed Service for Apache Flink, formerly Amazon Kinesis Data Analytics, processes the stream in real time.
  • Custom applications on Amazon EC2, Amazon EMR, or AWS Lambda process it too. For example, you can run Apache Spark on EMR, or a consumer that loads events into Memgraph for graph analytics.

The results power applications such as dashboards and alerts. This design is often called a streaming architecture.

AWS streaming architecture: data sources feed Kinesis services, then storage and custom processing, then dashboards and alerts

Real-Time Analytics on AWS

Imagine front-end applications, including web browsers, mobile apps, and IoT devices, that capture user activity. They send this data to Amazon API Gateway, which passes it to a real-time analytics service.

The service writes the events to Amazon Kinesis Data Streams, a streaming service similar to Kafka. From there, Amazon Data Firehose can store a copy of the raw data in Amazon S3.

To process the stream, you can use Amazon Managed Service for Apache Flink, formerly Amazon Kinesis Data Analytics. It generates real-time reports and pushes them to a dashboard. This design is often called a streaming architecture.

Front-end applications send events through an API gateway into a real-time analytics pipeline that feeds a dashboard and storage

Network Monitoring at Netflix

Netflix is a well-known example of stream processing in production. As of 2017, Netflix used Amazon Kinesis Data Streams to process terabytes of network flow logs every day, in a system it calls Dredge.

The architecture works like this:

  1. Netflix's AWS environment produces VPC flow logs that describe network traffic between applications.
  2. Kinesis Data Streams collects the logs centrally.
  3. A consumer application reads the stream and enriches each flow with application metadata.
  4. Engineers use the result to see which applications talk to each other and to trace traffic across regions.

Fraud Detection

Online payments, software-as-a-service platforms, and card networks all face fraud. Common attacks include brute-force logins and account takeovers using botnets.

Batch processing finds these attacks only after the damage is done. Stream processing lets companies spot fraudulent activity as it happens. For example, a login from a new IP address or an unusual location can trigger an immediate verification step.

Card issuers score transactions while they're being authorized. Fraud is stopped before it completes, and legitimate customers don't have to wait.

Many fraud schemes only show up in the connections between accounts, devices, and payments. Graph databases such as Memgraph help detect fraud by following those connections as new transactions arrive.

IoT

Connected devices produce data constantly. Even a small sensor sends readings every second, and fleets of devices add up to huge volumes.

Batch processing could collect this data once a day, but time-critical systems can't wait that long. Stream processing analyzes readings the moment they arrive.

In healthcare, stream processing helps clinicians monitor patients in real time. In the automotive industry, vehicles process sensor data in real time to support driver-assistance features.

Advertising and Personalization

Companies use stream processing to react to customer behavior in real time and personalize each user's experience. Some examples:

  • A new user signs up to a social media app and is immediately recommended potential connections.
  • A customer adds a food item to their cart in a delivery app and is offered a personalized discount.
  • A shopper clicks on a product and is shown similar products right away.

Further Reading

Join us on Discord!
Find other developers performing graph analytics in real time with Memgraph.
© 2026 Memgraph Ltd. All rights reserved.