Written by

Halkwinds Editorial Team

Halkwinds Research & Editorial

Published June 9, 2026
Blog image
Data & Analytics

Real-Time Analytics Architecture for Growing Companies

How to move from batch analytics to streaming — event sourcing, OLAP databases, and the operational overhead to budget for.

Your batch pipeline runs at 2 AM, and by the time the business sees yesterday's numbers, the decisions that mattered were already made twelve hours ago. For a while that's fine. But as your company grows, the gap between "something happened" and "we know about it" starts costing money — fraud slips through, inventory misfires, feature rollouts go sideways with no visibility. This is the moment most data teams start asking about real-time analytics architecture. This article walks through the shift from batch to streaming: the event-sourcing foundations, the OLAP engines that make sub-second queries possible, and — critically — the operational overhead nobody warns you about until you're paying for it.

  • Background / Why This Matters
  • Core Concepts and Architecture
  • Implementation Strategy
  • Scaling and Operational Considerations
  • Common Mistakes / What to Avoid
  • Frequently Asked Questions
  • Conclusion

Background / Why This Matters

Batch analytics — nightly ETL jobs feeding a data warehouse — is still the correct default for a lot of workloads. Financial reconciliation, month-end reporting, and model training rarely need to be fresh to the second. The problem is that as companies grow, more and more decisions become time-sensitive, and batch simply can't serve them.

Consider a few concrete pressures that push teams toward streaming:

  • Operational dashboards. An engineering or ops team watching order volume, error rates, or payment declines needs data that's seconds old, not hours.
  • Fraud and anomaly detection. Blocking a fraudulent transaction is only useful before the money leaves. A nightly batch job catches it after the fact.
  • Personalization. Recommending products based on what a user did five minutes ago converts far better than reacting to yesterday's session.
  • Alerting. Threshold breaches — cost spikes, SLA violations, inventory dropping to zero — lose most of their value with latency.

Research and industry surveys consistently suggest that the demand for lower-latency data is growing across sectors, but the honest framing is this: real-time is a cost, not a feature. Every reduction in latency increases infrastructure spend, operational complexity, and on-call burden. The job of a good data engineer is to identify which use cases actually justify that cost.

Actionable takeaway: Before building anything, write down each analytics use case and the maximum tolerable latency. If the honest answer is "an hour is fine," don't build streaming for it — you'll save six figures over three years.

Core Concepts and Architecture

A real-time analytics stack typically has four layers: ingestion, transport, processing, and serving. Understanding what each does prevents you from bolting a streaming tool onto a batch mindset.

Event sourcing and the log

The foundation of most real-time systems is treating your data as an immutable, append-only log of events rather than a mutable set of tables. Instead of storing "the current order state," you store every event that changed it: OrderCreated, ItemAdded, PaymentConfirmed, OrderShipped. The current state becomes a projection you can rebuild by replaying the log.

Apache Kafka is the de facto standard here. It acts as a durable, partitioned, replayable log that decouples producers (your applications) from consumers (your analytics jobs). Kafka's replayability is what makes it more than a message queue — if a downstream consumer has a bug, you fix the code and reprocess from an earlier offset rather than losing data forever.

Stream processing

Raw events are rarely useful on their own. You need to filter, enrich, aggregate, join, and window them. Apache Flink is the strongest general-purpose engine for this, offering true event-time processing, exactly-once semantics, and sophisticated windowing (tumbling, sliding, session windows). Flink is what you use when you need stateful computations — for example, "count distinct users per product per five-minute window, accounting for events that arrive late."

Lighter alternatives include Kafka Streams (a library, not a cluster) for simpler transformations, and managed offerings that reduce the operational footprint.

The OLAP serving layer

Processed data needs to land somewhere that supports fast analytical queries over large volumes. This is where OLAP databases come in. Traditional row-oriented databases (Postgres, MySQL) choke on analytical scans across billions of rows. Column-oriented OLAP engines are built for exactly this.

ClickHouse is a standout: a columnar database that can ingest millions of rows per second and return aggregations over billions of rows in well under a second. It supports real-time inserts, materialized views that pre-aggregate on write, and a Kafka table engine that consumes directly from topics.

How the pieces fit together

A typical end-to-end flow looks like this:

  1. Applications emit events to Kafka topics.
  2. Flink consumes those topics, performs enrichment and windowed aggregation, and maintains state.
  3. Results flow into ClickHouse, either via Flink sinks or ClickHouse's native Kafka engine.
  4. Dashboards, APIs, and alerting systems query ClickHouse for sub-second results.

Actionable takeaway: Keep the raw event log (Kafka) as your source of truth, and treat OLAP tables as disposable projections you can rebuild. This gives you the freedom to change schemas and fix bugs by reprocessing rather than migrating.

Implementation Strategy

The biggest mistake teams make is trying to replace their entire batch stack in one project. Don't. Migrate incrementally, one high-value use case at a time.

Phase 1: Instrument and capture

Start by producing clean events to Kafka without changing any consumers. Define a schema (use Avro or Protobuf with a schema registry to prevent breaking changes) and get your applications emitting events. Your existing batch jobs can keep reading from the database; Kafka just becomes a parallel, replayable capture stream.

Phase 2: Build one real-time projection

Pick a single, well-scoped use case — say, a live operational dashboard for orders. Wire Kafka into ClickHouse (even skipping Flink initially if your transformations are simple) and build the dashboard. This proves the pipeline end-to-end and gives the business a visible win.

Phase 3: Add stateful processing

Once you need joins, sessionization, or late-event handling, introduce Flink. This is where complexity jumps, so wait until a use case genuinely requires it.

Here's how the major components compare when you're choosing what to adopt and when:

ComponentRoleWhen you need itOperational cost
Apache KafkaDurable event log / transportAs soon as multiple consumers need the same eventsMedium — cluster management, partition tuning
Apache FlinkStateful stream processingWindowing, joins, late-event handlingHigh — state management, checkpointing, tuning
ClickHouseOLAP serving layerFast queries over large volumesMedium — sharding, replication, merge tuning
Kafka StreamsLightweight processingSimple filters/maps embedded in a serviceLow — no separate cluster

This kind of phased rollout is where an experienced partner pays for itself. Halkwinds' Data & Analytics practice regularly helps teams design the event schema and prove one pipeline before committing to a full platform — the goal being to de-risk the architecture before the operational costs scale up.

Actionable takeaway: Ship a working real-time slice within the first month. Momentum and a visible business result buy you the credibility to invest in the harder pieces later.

Scaling and Operational Considerations

This is the section batch teams underestimate the most. Streaming systems are always on. There's no 2 AM window where nothing is happening — every component runs 24/7, and every component can fail at 3 AM.

Budget for people, not just servers

Running Kafka, Flink, and ClickHouse well typically requires dedicated ownership. Estimates vary, but many teams find they need at least one engineer who deeply understands each stateful system. Managed services (Confluent Cloud, managed Flink offerings, ClickHouse Cloud) trade dollars for reduced headcount — often a good trade for growing companies that can't hire a five-person platform team.

State is the hard part

Flink's power comes from its state, and state is also its main operational hazard. You must configure checkpointing to durable storage (S3 or equivalent), plan for savepoints when deploying new code, and monitor state size — a large keyed state can slow recovery to a crawl. Test your failure recovery before you rely on it in production.

Backpressure and lag monitoring

Monitor consumer lag on every Kafka consumer group. Rising lag means your processing can't keep up with ingestion, and it's the earliest warning of trouble. Instrument Flink backpressure and ClickHouse merge/insert queues too. Alert on trends, not just thresholds.

Data correctness at scale

Exactly-once semantics are achievable but require deliberate configuration across Kafka, Flink, and your sinks. Idempotent writes to ClickHouse (using deduplication via ReplacingMergeTree or insert deduplication) protect you when reprocessing. Assume you will reprocess, and design for it.

Actionable takeaway: Before going live, run a game day: kill a Flink task manager, restart a Kafka broker, and force a ClickHouse replica failure. If recovery isn't automatic and understood, you're not ready for production.

Common Mistakes / What to Avoid

  • Making everything real-time. Streaming a report that's read once a week is pure waste. Reserve real-time for genuinely latency-sensitive use cases.
  • Skipping the schema registry. Without enforced, versioned schemas, one careless producer change breaks every downstream consumer silently.
  • Treating Kafka as a database. Kafka is a log, not a query store. Don't build query logic on top of raw topics — that's what the OLAP layer is for.
  • Underestimating ClickHouse's quirks.