Real-Time Analytics Architecture: Layers, Patterns, Tradeoffs
Real-Time Analytics Architecture: Layers, Patterns, Tradeoffs A real-time analytics architecture moves events from where they happen to where someone can act on them, continuously, instead of waiting for a nightly job.
Real-Time Analytics Architecture: Layers, Patterns, Tradeoffs
A real-time analytics architecture moves events from where they happen to where someone can act on them, continuously, instead of waiting for a nightly job. In practice that means four layers: ingestion, stream processing, a serving store, and a consumption layer such as dashboards, APIs, or alerts. The hard part is rarely picking tools. It is deciding how fresh each answer really needs to be, and paying only for that.
This guide walks through the layers, the Lambda and Kappa patterns, the design decisions that cause trouble in production, and a way to right-size the build. It is written for business, operations, and technology leaders who will sponsor or review this kind of system, not only for the engineers who will build it.
Key Takeaways
- A streaming architecture has four layers: ingest, process, serve, consume. Latency accumulates across all of them, so measure end to end.
- Start from the decision, not the technology. A fraud check and an inventory dashboard need very different freshness, and the cost curve is steep.
- Kappa (one streaming pipeline) fits most new builds. Lambda (batch plus streaming) earns its extra cost only when two accuracy standards must coexist.
- Late data, backpressure, schema changes, and governance are what break systems after launch. Design for them on day one.
- Right-sized beats maximal. Many teams need minutes, not milliseconds.
Table of Contents
- What a real-time analytics architecture is
- The four layers, and how data moves through them
- Streaming vs. batch: what actually differs
- Lambda vs. Kappa: which pattern fits
- Design decisions that decide whether it holds up
- A right-sized path from idea to production
- How Ridiculous Engineering helps
- FAQ
- Sources
What a real-time analytics architecture is
Batch systems collect data, wait for a scheduled job, and publish results hours later. A real-time system treats data as a continuous stream: each event is captured, processed, and made queryable within seconds or less. The AWS Well-Architected analytics guidance describes the core components of a streaming design as data sources, stream ingestion and producers (for example change data capture or Kafka Connect), stream storage (for example Kafka or Kinesis), stream processing (for example Flink or Spark), and downstream destinations, as laid out in its streaming reference architecture.

That list is a useful checklist for a first whiteboard session. If a vendor proposal skips one of these boxes, ask where that responsibility lives.
“Real time” is a business term before it is a technical one
Nobody needs everything in milliseconds. A payment fraud check may need an answer in well under a second. A warehouse inventory view may be perfectly useful when it refreshes every few minutes. A weekly executive report may not need streaming at all.
Before any architecture diagram, write down for each use case:
- The decision or action the data supports.
- Who or what takes that action (a person, an application, an automated rule).
- How stale the data can be before the decision gets worse.
- What a wrong or incomplete answer costs.
Those four answers set your latency budget. Everything below is built to meet it, and no tighter.
The four layers, and how data moves through them
1. Ingestion: capture and buffer
Events come from application databases, user clicks, payment systems, IoT sensors, logs, and third-party APIs. Ingestion captures them reliably and puts them somewhere durable. Two common approaches:
- Event publishing from applications. The application emits a business event (“order placed”) to a stream. Clean semantics, but it requires changes to application code.
- Change data capture (CDC). A connector reads the database’s change log and publishes each insert or update. Less invasive for legacy systems, which is why it shows up so often in modernization projects.
The buffer matters as much as the capture. A streaming platform works as a distributed, append-only log in which events are retained for a configurable period, from hours to months or even indefinitely, and stay available for any consumer to read, as one industry guide on real-time analytics applications describes it. That retention is what lets you replay history after a bug fix or add a new consumer later without touching the source system. If you want a deeper engineering view of this layer, our practical guide to event streaming with Kafka covers topics, partitions, and delivery guarantees.
2. Processing: validate, enrich, aggregate
The processing layer turns raw events into something useful: validating them, joining them to reference data, computing running totals, detecting patterns, or scoring them with a model. Microsoft’s guidance on choosing a stream processing technology points out that the decision often turns on whether you need stateful or stateless processing and whether you need time windows, either tumbling (fixed, non-overlapping) or sliding (overlapping), for time-based aggregations.
In plain terms:
- Stateless work (filtering, parsing, simple transforms) is cheap and easy to scale.
- Stateful work (“count of failed logins per user in the last five minutes”) must remember things, which affects memory, recovery, and cost.
- Windows define “the last five minutes” and are where most correctness surprises live.
3. Serving: a store built for the question
Processed data lands in a store matched to how it will be queried. There is no single right answer:
| Access pattern | Typical serving choice | Why |
|---|---|---|
| Ad hoc slicing and dashboards over fresh data | Analytical (OLAP) store or lakehouse tables | Fast aggregations over large volumes |
| Per-customer or per-item lookups from an app | Key-value or document store | Single-record reads at low latency |
| Mixed historical and recent analysis | Lakehouse with streaming and batch on the same tables | One copy of the data |
For the lookup case, Microsoft’s near real-time lakehouse reference scenario denormalizes data into a NoSQL store such as Azure Cosmos DB to support single-digit millisecond API responses. For the lakehouse case, the same scenario uses Delta Lake, which provides ACID semantics and unified streaming and batch processing on a data lake.
The design principle: shape the data for the reader. Pre-aggregating and denormalizing at write time is what makes reads fast.
4. Consumption: dashboards, APIs, alerts, and models
This is where the business sees value, and where latency requirements differ most. A live operations screen, a customer-facing metric inside your product, an alert to an on-call manager, and a feature feed for a machine-learning model all read from the serving layer differently. Plan the consumers first and work backward.
A dashboard nobody trusts or understands wastes the whole pipeline. People reading live numbers also need the skills to interpret them, which is why some organizations pair a platform rollout with a web analytics training course for the analysts and managers who will live in the dashboards. Our guide to self-service analytics goes further on making that last mile work.
Latency is the sum of every stage
It is tempting to benchmark the processing engine and call it done. But end-to-end latency is the total of capture, network transit, buffering, processing, writing to the store, query time, and dashboard refresh. Instrument each hop with timestamps from day one. When a stakeholder says “the dashboard feels slow,” you want to know which stage ate the seconds.
Streaming vs. batch: what actually differs
Beyond freshness, the two models have different engineering tradeoffs. Research on the subject notes that streaming engines face latency-throughput tradeoffs: acknowledging messages one by one to guarantee delivery adds overhead and is less efficient than processing in batches, according to Jimmy Lin’s IEEE analysis of the Lambda and Kappa architectures.
That has practical consequences for planning:
- Streaming costs more per record than batch when you run it around the clock. If a hourly refresh satisfies the decision, batch is the honest answer.
- Streaming makes you handle things batch hides: out-of-order events, duplicate delivery, and partial results.
- Operations change. A nightly job that fails can be rerun in the morning. A stream that stalls at 2 a.m. is an incident.
A hybrid is normal. Many companies stream the 10 percent of data that drives time-sensitive decisions and leave the rest in batch.
Lambda vs. Kappa: which pattern fits
These two names come up in nearly every architecture review, so it is worth being precise.
Lambda was proposed by Nathan Marz around 2011. It runs a batch layer and a transient real-time layer side by side, with a merging layer that combines their results. The batch layer gives accurate, complete answers eventually. The speed layer gives approximate answers now.
Kappa was proposed by Jay Kreps in a 2014 blog post. It uses a single stream-processing engine for all data and avoids Lambda’s dual-pipeline complexity. Historical data is reprocessed by replaying the log through the same code. Both descriptions come from the Lin paper.
The honest tradeoff
| Lambda | Kappa | |
|---|---|---|
| Pipelines to build and run | Two (batch and streaming) | One |
| Business logic | Often written twice, must stay in sync | Written once |
| Historical reprocessing | Batch job | Replay from the log |
| Operational burden | Higher | Lower, but needs durable log retention |
| Best when | Different accuracy standards for different consumers | One consistent standard for all consumers |
The duplicated logic is the real cost of Lambda. When two codebases compute “revenue,” they will eventually disagree, and someone will spend a week finding out why.
Our recommendation for most new systems: begin with Kappa thinking. Keep a durable event log, write logic once, and replay when you need to correct history. Add a separate batch path only when you have a documented reason, such as a requirement that billing be exact while an operations dashboard tolerates small errors. Modern lakehouse tables that handle streaming and batch on the same data narrow the gap further, because you get one storage layer with two ways of reading it.
Design decisions that decide whether it holds up
The diagram looks the same across projects. The differences that matter are below.
Late and out-of-order data
Events do not arrive in the order they happened. Mobile devices go offline, networks lag, upstream systems retry. Stream processors handle this with watermarks: a moving estimate of how far event time has progressed, used to decide when a window is complete enough to publish.
The tradeoff is direct. A tight watermark publishes results quickly but drops or mishandles stragglers. A loose one waits longer, improving completeness but increasing delay and the state the system must hold. Pick the value from observed lateness in your actual data, not from a default. Then decide explicitly what happens to events that arrive after the window closes: discard, route to a correction path, or update the result.
Backpressure and durability
What happens when a downstream store slows down? Without a plan, the answer is data loss or a cascading failure. A good pipeline buffers in the durable log, slows producers or scales consumers, and alerts someone, rather than silently dropping records. Ask your team to demonstrate this by deliberately slowing a consumer in a test environment.
Delivery guarantees
“Exactly once” is the goal for anything financial or inventory-related, but it is a property of the whole pipeline, not one component. Where it cannot be guaranteed end to end, design writes to be idempotent, so a replayed event does not double count.
Schema change and data quality
Producers change their event formats, usually without warning. Use a schema registry, validate at ingestion, and send bad records to a quarantine stream with an alert instead of letting them poison downstream tables. The same discipline you apply to application releases applies here: our write-up on CI/CD for data pipelines shows how pull-request-gated schema checks catch breaking changes before they hit production.
Security and governance
Streaming does not exempt you from governance. If anything, it raises the stakes, since data moves faster than a manual review can. Treat access control, encryption, retention, lineage, and schema ownership as part of the architecture, particularly in regulated settings like healthcare, finance, and government, where governance has to operate at the same pace as the data. Decide who owns each event type, who may read it, and how long it is kept before the first event flows.
Push intelligence to the edge when it saves money
For cameras, sensors, and machines producing high-volume data, filter and run inference locally and send only aggregates or exceptions upstream. This cuts bandwidth and cloud spend and shortens response time for local actions.
A right-sized path from idea to production
Most failed real-time projects did not choose the wrong technology. They tried to stream everything at once. A sequence that works:
- Pick one decision. For example, flag stalled orders within two minutes, or show live stock levels per warehouse. Define the latency budget and the cost of a wrong answer.
- Map the sources. Which systems hold the events? Can you publish them, or do you need CDC? Which of these systems are old enough to make that hard?
- Build the thinnest vertical slice. One source, one processing job, one serving store, one consumer, with end-to-end timing instrumentation.
- Add the failure paths. Late data, replay, quarantine, alerting, and a runbook for the stalled stream.
- Measure the outcome. Did the decision improve? Fewer stockouts, faster fraud holds, shorter response times? If the number does not move, stop before scaling.
- Expand deliberately. Add sources and consumers one at a time, reusing the platform.
The business case behind this is covered in our overview of why real-time data changes how businesses operate. The short version: the payoff comes from faster decisions, not from the streaming technology itself.
Build, buy, or blend
Managed cloud services reduce operational work but add lock-in and recurring cost. Open source engines give control but need people to run them. Custom code around either one is where your business logic and competitive differences live. The right mix depends on your team’s size, your compliance needs, and how many systems must connect. Be wary of any approach that cannot explain what happens at 2 a.m. when something fails.
How Ridiculous Engineering helps
We design and build the pieces that sit between your business problem and a working system: event ingestion from legacy and modern sources, processing pipelines, serving stores, and the dashboards and applications on top. Our data analytics and business intelligence work starts with the decision you need to improve and the latency it really requires, then sizes the architecture to match. When the consumer is an application or workflow, our custom software development team builds that side with the same senior engineers, and our AI development and automation work covers models and automated actions fed by live data. Pricing depends on scope, so the next step is a conversation about your use case and a quote.
FAQ
What is the difference between real-time and streaming analytics?
In everyday use the terms overlap. Streaming describes the technique, processing events continuously as they arrive. Real-time describes the outcome, results fresh enough to act on within a time budget you define. You can stream data and still deliver results every few minutes, which is often all the business needs.
Should I choose Lambda or Kappa?
For most new systems, start with Kappa: one streaming pipeline, logic written once, and history reprocessed by replaying a durable log. Choose Lambda only when two consumers need different accuracy guarantees, such as exact billing figures alongside a tolerant live dashboard. Weigh that against the cost of maintaining two code paths.
How fast does my system need to be?
Work backward from the decision. A fraud check can require sub-second answers, while an inventory or sales dashboard may be fine refreshing every few minutes. Each step down in latency raises cost and operational effort, so set the target from the value of the decision, not from what the tools can do.
Do we need Kafka?
Not always. A durable, replayable event log is the important capability, and Kafka is one common way to get it. If your volume is modest and your sources are few, a managed streaming service or even frequent micro-batches may be enough. Our Kafka guide for engineers can help you judge.
What breaks most often after launch?
The usual causes are upstream schema changes, late or duplicate events, and slow downstream stores that create backpressure. Validation at ingestion, idempotent writes, a quarantine path for bad records, and alerting on lag address most of them.
Sources
- Reference architecture, Data Analytics Lens (AWS Well-Architected)
- Choose a stream processing technology (Microsoft Learn)
- Near real-time lakehouse data processing (Microsoft Learn)
- The Lambda and the Kappa (Jimmy Lin, IEEE 2017)
- Building Real-Time Analytics Applications
- Web analytics training course