Skip to content

The Hidden Cost of Real-Time Systems: Latency, Illusion, and Architectural Consequences

See also: Observability vs Monitoring β€” the observability infrastructure that streaming systems make significantly more demanding.

Themes: Data Architecture Β· Economics Β· Infrastructure


Opening Thesis

Real-time systems are rarely about speed. The performance ceiling of modern infrastructure β€” submillisecond network RTT, nanosecond in-memory access, multi-gigabit throughput β€” is not typically what constrains a system from delivering timely data. What constrains it is complexity: the coordination, consistency, and failure-handling burden that streaming architectures impose relative to their batch equivalents.

The demand for real-time capability is frequently a product of expectations rather than operational necessity. A business intelligence dashboard that refreshes every 15 seconds is indistinguishable from one that refreshes every 5 seconds to a human analyst making strategic decisions. A fraud detection system that responds in 200 milliseconds is operationally equivalent to one that responds in 50 milliseconds in most payment authorization flows. The engineering investment required to move from one to the other is not marginal. It is substantial, and it propagates through every layer of the system.

This is an analysis of what real-time systems actually cost β€” in infrastructure, in operational burden, in organizational expectation inflation β€” and when that cost is justified.


Historical Context

Batch as the Default

The default computational model from the earliest days of digital computing through the early 2000s was batch processing: accumulate data, process it together, produce output. Payroll runs happened weekly. Financial reconciliation happened nightly. Reports were produced daily. The batch model imposed a latency floor β€” results were no fresher than the most recent batch β€” but it also provided natural economies: data could be compressed for processing, failures could be rerun over the same input, and the system's resource requirements were predictable.

The batch model's latency floor was not experienced as a deficiency because the systems it served β€” financial records, business reports, inventory systems β€” operated on timescales where daily refresh was sufficient. The expectation of fresh data was calibrated to what was technically available.

Near-Real-Time and Micro-Batch

The emergence of web analytics, online advertising, and e-commerce in the 2000s created demand for data latency measured in minutes rather than hours. Micro-batching β€” processing data in batches of 1 to 5 minutes rather than hours β€” became the pragmatic middle ground. Tools like Apache Storm (2011) and Apache Spark Streaming's micro-batch model made this practical at scale.

Micro-batching preserved much of the simplicity of batch processing β€” data arrived in discrete chunks, processing was stateless per batch, failures could be retried β€” while reducing latency from hours to minutes. For many analytical workloads, minutes-fresh data was indistinguishable from seconds-fresh data in its business value.

The Kafka Era and the Streaming Explosion

Apache Kafka's release (2011) and its adoption at LinkedIn, then across the industry, created the infrastructure for persistent, replayable, high-throughput event streams. Kafka's append-only log model provided both the durability of batch storage and the latency characteristics of event streaming. Apache Flink (2014), the first major general-purpose stream processor designed around per-event processing with exactly-once semantics, completed the streaming infrastructure stack.

The streaming explosion that followed was partly demand-driven (fraud detection, real-time recommendation, operational monitoring) and partly technology-driven: Kafka and Flink existed, they were capable, and their existence created organizational interest in finding problems they could solve.

"Real-Time Dashboards" as Product Feature

The product marketing dimension of real-time data is significant and underappreciated. In the 2010s and 2020s, "real-time" became a selling point for data products regardless of whether the real-time latency provided operational value. A dashboard that could claim "powered by real-time data" was more marketable than one that displayed data refreshed every 15 minutes, even if the decisions made from the dashboard operated on timescales where the distinction was irrelevant.

This marketing dimension has engineering consequences: systems are built to lower latency thresholds than business requirements justify, incurring engineering and operational costs that produce no measurable business benefit.


What "Real-Time" Actually Means

The term "real-time" carries different technical meanings in different contexts, and conflating them produces architectural decisions calibrated to the wrong requirements.

  Latency spectrum from batch to hard real-time:
  ─────────────────────────────────────────────────────────────────────────
  Batch             Hours to days     Financial reporting, daily analytics
  Micro-batch       1–5 minutes       Operational dashboards, session analytics
  Near-real-time    10–60 seconds     Live pricing, inventory updates
  Streaming         100ms – 5s        Fraud detection, recommendations
  Soft real-time    10–100ms          Collaborative editing, gaming state
  Hard real-time    <10ms (bounded)   Industrial control, safety systems
  ─────────────────────────────────────────────────────────────────────────
  Engineering cost: ──────────────────────────────────────────────────►
  Complexity:       ──────────────────────────────────────────────────►
  Business cases:   ◄──────────────────────────────────────────────────

Hard real-time systems guarantee that operations complete within a bounded time window. Missing the deadline is a system failure, not a performance degradation. Industrial process control, automotive safety systems, and avionics are hard real-time; they typically run on real-time operating systems (RTOSes) on dedicated hardware, not on general-purpose cloud infrastructure.

Soft real-time systems have latency objectives but tolerate occasional misses. A multiplayer game that fails to deliver a state update within 50ms on one frame degrades the user experience but does not cause a system failure. Most consumer software labeled "real-time" operates in this range.

Streaming in the data engineering sense refers to per-event or micro-batch processing with latency in the range of 100ms to several seconds. This is not hard real-time. Kafka producers and consumers, Flink jobs, and Spark Structured Streaming operate in this range.

Human perception thresholds are the practical boundary for most analytical real-time requirements. Research on perceived responsiveness suggests that users notice latency differences larger than ~100ms for direct interactions, and ~1 second for feedback on initiated actions. A data refresh that crosses from 30 seconds to 5 seconds is not noticed by a human reading a dashboard; a response to a button press that crosses from 100ms to 1000ms is immediately perceptible as sluggish. The implication is that most "real-time dashboard" requirements are satisfied by 30-second refresh intervals β€” micro-batch territory β€” rather than streaming.


Infrastructure Costs

Stateful Stream Processors

The fundamental challenge of stream processing is that many useful operations are not stateless. A fraud detection system that must recognize that the same card has been used in three different cities within 10 minutes requires state: the history of recent transactions associated with each card. A session analytics system that attributes page views to sessions requires state: which user, which session, which sequence of events.

Stateful stream processing requires each event to be associated with its corresponding state, which must be stored and retrieved β€” typically from an in-memory state backend (RocksDB in Flink, in-memory in Spark Streaming) β€” for every event. The state backend must be large enough to hold the working set of active state, fast enough to not become a throughput bottleneck, and durable enough to survive process restarts.

The state management requirement adds infrastructure complexity that stateless batch processing does not have: state backends require tuning, monitoring, and capacity planning independent of the stream processing application logic.

Backpressure Handling

When a stream processing system receives events faster than it can process them, the upstream producer must be signaled to slow down β€” backpressure. Without backpressure signaling, the stream processor buffers events until memory is exhausted, then either drops events or crashes.

Backpressure propagation through a pipeline of stream processors is a coordination problem that batch systems do not have: in batch processing, if downstream processing is slow, the upstream source simply waits for the next scheduled run. In streaming, slowness must be communicated continuously across potentially many processing stages, with each stage adjusting its consumption rate.

Checkpointing and Recovery

Exactly-once semantics β€” the guarantee that each event is processed exactly once, not zero times and not more than once β€” requires checkpointing: periodically persisting the complete state of the stream processor to durable storage, so that in the event of a failure, processing can resume from the last checkpoint rather than from the beginning of the stream.

Checkpointing is not free. Each checkpoint writes the full state of all stateful operators to durable storage (typically distributed filesystem or object storage). For large state (session data for millions of concurrent users, for example), checkpoints are substantial write operations that consume I/O bandwidth and introduce processing pauses. Checkpoint intervals must be tuned: too infrequent means more reprocessing on failure; too frequent means excessive checkpoint I/O overhead.

Data Duplication

Real-world streaming systems frequently produce duplicate events β€” the same logical event is delivered more than once, due to producer retries, consumer failures that trigger reprocessing from the last checkpoint, or network delivery that is not exactly-once. Handling duplicates in the processing logic (deduplication by event ID, idempotent state updates) adds engineering complexity that batch processing β€” where reprocessing the same input produces the same output by construction β€” does not require.


Observability Explosion

Streaming pipelines are significantly harder to observe than batch pipelines. The state of a batch job at any point is: running, succeeded, or failed. The state of a streaming pipeline at any point is: a continuous flow of events with lag, throughput, error rate, state size, and checkpoint duration metrics that must all be monitored simultaneously and whose interactions produce emergent failure modes.

Consumer lag β€” the delay between when an event is produced and when it is consumed β€” is the primary streaming health metric, but it is not sufficient for diagnosing problems. Lag can grow because the consumer is slow, because upstream producers have accelerated, or because the consumer has stopped entirely. Distinguishing these causes requires additional metrics and context.

Late-arriving data β€” events that arrive after the watermark that marks their logical time β€” is a fundamental streaming problem without a clean solution. Processing them requires either extending the watermark window (increasing latency) or dropping them (losing data). The decision depends on the business semantics of the specific stream, which requires domain understanding that generic observability tooling cannot provide.

Ordering guarantees vary by streaming system and topology. Kafka guarantees order within a partition, not across partitions. Flink guarantees order relative to event time watermarks, not ingestion time. When ordering guarantees are violated by producer behavior or partition assignment changes, the resulting data errors may not surface as errors in the stream processor β€” they appear as incorrect aggregations in the output.


Economic Trade-Offs

Dimension Batch Micro-Batch Streaming
Compute cost (steady state) Low (scheduled) Moderate (continuous) High (always-on cluster)
Infrastructure cost Low Moderate (Kafka + processor) High (Kafka + stateful processor + state backend)
Engineering overhead Low Moderate High (backpressure, checkpointing, dedup, ordering)
Operational burden Low (cron + alerts) Moderate High (lag monitoring, state tuning, checkpoint management)
Debugging complexity Low (batch replay) Moderate High (stateful replay, ordering reconstruction)
Data freshness Hours to days Minutes Seconds to sub-second
Failure recovery Simple rerun Checkpoint rerun Complex (exactly-once semantics)
Cost per unit of freshness Very low Low–moderate High

The cost per unit of freshness β€” the engineering and infrastructure investment required to reduce data latency by a given interval β€” is not linear. Moving from daily batch to hourly batch is a scheduling change. Moving from hourly to 5-minute micro-batch requires a streaming infrastructure investment. Moving from 5-minute micro-batch to 5-second streaming requires exactly-once semantics, stateful processing, and continuous operational monitoring. Each step down the latency stack requires non-proportionally more investment.


When Real-Time Is Justified

The cases where the streaming investment is justified are specific and share a common characteristic: the value of the data degrades rapidly with latency, and the cost of degraded value exceeds the cost of the streaming infrastructure.

Fraud detection is the canonical case. A fraudulent transaction authorized 30 seconds ago may have led to 20 additional fraudulent transactions before the pattern is detected. Every second of latency in fraud signal propagation has a direct dollar cost. The streaming infrastructure investment is justified because the cost of delayed detection is quantifiable and large.

Safety-critical control loops β€” industrial process monitoring, power grid balancing, autonomous vehicle sensor fusion β€” require hard real-time properties that streaming architectures in the data engineering sense cannot provide. These systems run on dedicated real-time infrastructure, not on Kafka and Flink.

Live auction and pricing systems β€” ad bidding, exchange trading, dynamic pricing β€” operate in competitive environments where latency differences of seconds produce measurable revenue differences. The streaming investment is justified by the competitive revenue impact of latency.

Operational systems that drive immediate action β€” alerting systems where a human must respond within minutes, supply chain systems where a stockout triggers immediate replenishment, ride-sharing systems where driver assignment requires fresh location data β€” have latency requirements that micro-batch or streaming satisfies and that batch does not.

The important counterexamples: business intelligence dashboards consumed by analysts making strategic decisions, data science feature pipelines for models retrained weekly, reporting systems for compliance submissions, and most internal analytics workloads. For these, batch or micro-batch freshness is operationally indistinguishable from streaming freshness and costs a fraction as much.


Decision Framework

Stay batch when: the consuming decision is made less frequently than the batch interval; the downstream consumer does not require fresher data; the cost of streaming infrastructure exceeds the value of latency reduction; the team does not have streaming operational expertise.

Use micro-batch when: the consuming system benefits from data fresher than one hour but does not require sub-minute freshness; the workload is primarily analytical and stateless per batch; the team can operate a Kafka topic and a scheduled Spark or dbt job; the latency requirement can be satisfied by 1–5 minute refresh intervals.

Go fully streaming when: the value of the data degrades measurably within seconds; the system drives immediate automated action (fraud block, live pricing, anomaly response); exactly-once semantics are required for correctness; the team has streaming operational experience and the infrastructure budget to sustain an always-on cluster.

The question to ask before any streaming architecture decision: what is the actual business cost of increasing data latency from 5 seconds to 5 minutes? If the answer is not quantifiable, or if it is quantifiably small, the streaming investment is not justified.

See also

Decision Frameworks

The structured decision framework from this essay β€” batch vs micro-batch vs streaming by latency requirement and operational cost β€” is indexed at Decision Frameworks β†’ When to Go Real-Time. For the recurring mistake this essay addresses, see Anti-Patterns β†’ Real-Time by Default.