VAYULearn
Colour theme
Investigate a failure
VAYU Learn

Kafka & Streaming

Real-Time ETL Patterns: Event-Driven, Micro-Batching, Log-Based ETL

How modern data teams move data in real time without lying to themselves about latency, correctness, or cost.

Kafka & StreamingDatabricks & LakehouseData Architecture & Reliability
Figure 1 - Real-time ETL patterns compared: event-driven pipelines for instant reactions, micro-batching for scalable analytics, and log-based ETL (CDC) for reliable data synchronization.

TL;DR

There is no single “real-time ETL.” There are three distinct patterns, each solving a different problem:

  • Event-Driven ETL → ultra-low latency, application-centric
  • Micro-Batch ETL → balance between scale and simplicity
  • Log-Based ETL (CDC) → correctness, completeness, and replayability

Most production systems use at least two of these together.
Teams that mix them blindly end up with silent data corruption.


📘 Introduction

“Real-time ETL” is one of the most abused phrases in data engineering.

Some teams mean milliseconds.
Some mean every 5 minutes.
Some mean whenever the cron runs.

That ambiguity is why pipelines break.

Real-time ETL is not about speed alone. It’s about:

  • How data moves
  • When transformations happen
  • What guarantees you get
  • What breaks when things go wrong

Let’s dismantle the hype and look at the three real patterns that actually work in production.


🧠 1. Event-Driven ETL — React to Every Event

Event-driven ETL processes each event as it arrives.

Event → Transform → Emit → Downstream

Typical stack

  • Event source → Apache Kafka
  • Stream processing → Flink / Kafka Streams
  • Output → downstream services, caches, feature stores

🧩 Architecture Diagram

Producer → Event Stream → Stream Processor → Sink
(Kafka) (Flink/Streams) (Apps/Stores)

Where it shines

  • Fraud detection
  • Alerts & notifications
  • Stateful application logic
  • Real-time personalization

Latency: milliseconds to seconds

Throughput note:
Event-driven systems can achieve high throughput, but throughput is bounded by per-event processing cost and state complexity, not raw ingestion speed. Heavy state, joins, or external calls reduce effective throughput fast.

Where it breaks

  • Hard to backfill
  • Complex state management
  • Debugging is painful
  • Schema changes ripple instantly

Mentor truth:
Event-driven ETL is powerful, but it’s not analytics-friendly by default.


🔄 2. Micro-Batch ETL — Real Time with Control

Micro-batching groups events into small, frequent batches.

Events (5–60s) → Batch → Transform → Write

This is the workhorse of modern data platforms.

🧩 Architecture Diagram

Event Stream → Micro-Batches → Spark Jobs → Lakehouse
(30 sec) (Structured)

Usually implemented with Apache Spark Structured Streaming.

Why engineers love micro-batching

  • Easier debugging
  • Better throughput
  • Natural fit for aggregations
  • Backfills are manageable
  • Plays well with Lakehouse tables

Latency: seconds to a few minutes

Where it shines

  • Near real-time dashboards
  • Streaming aggregations
  • Medallion (Bronze → Silver → Gold) pipelines
  • Cost-controlled real-time analytics

Where it’s weak

  • Not sub-second
  • Not ideal for reactive systems
  • Window tuning matters a lot

Mentor truth:
If you say “real-time” but your users can tolerate 30–60 seconds, micro-batching is probably the right answer.


🔄 3. Log-Based ETL (CDC) — Move Changes, Not Data

Log-based ETL streams database changes using transaction logs.

INSERT / UPDATE / DELETE → Change Events → ETL

🧩 Architecture Diagram

OLTP DB
↓
Transaction Logs (WAL / Binlog)
↓
CDC Engine
↓
Kafka
↓
Lakehouse / Warehouse / Apps

Common tooling:

  • Debezium
  • Kafka Connect
  • Managed CDC (e.g., Fivetran)

Why CDC is special

  • Exact row-level changes
  • Correct deletes
  • Ordering guarantees
  • Minimal DB load
  • Replayable

Latency: seconds

Important caveat:
CDC is not analytics-friendly by default.
It becomes analytics-ready only after:
Primary keys are enforced
Deletes are applied correctly
Changes are merged/compacted (not left append-only)
Schema evolution is handled explicitly
Raw CDC streams should never power dashboards directly.

Where it shines

  • Replicating OLTP → analytics
  • Keeping systems in sync
  • ML feature freshness
  • Slowly changing dimensions (done right)

Where teams mess up

  • Ignoring deletes
  • Treating CDC as append-only
  • No primary keys
  • No replay strategy

Mentor truth:
CDC is the most correct real-time ETL pattern — and the easiest to misuse.


🧩 4. Side-by-Side Comparison

This comparison cuts through buzzwords and shows how each real-time ETL pattern behaves under real production constraints.

Table — Event-driven vs micro-batch vs log-based ETL: a practical comparison based on latency, correctness, operational cost, and analytics suitability.

Event-driven pipelines tend to have the least predictable cost due to always-on processing and stateful compute, while micro-batch and CDC benefit from more stable, windowed execution.

Most production systems don’t choose one pattern — they combine them intentionally. The mistake is using the wrong one where it doesn’t belong.


🏗️ 5. How These Patterns Coexist (Real Systems)

The mistake is choosing one.

Real platforms use all three:

User Clicks ──► Event-Driven ETL ──► Alerts / Features
│
└──► Micro-Batch ETL ──► Metrics / Dashboards
│
└──► CDC ──► OLTP Sync / Lakehouse

Each pattern has a boundary.
Good architecture respects those boundaries.


🧪 6. Real-World Use Cases

🛒 E-commerce

  • CDC → Orders & inventory
  • Micro-batch → Revenue dashboards
  • Event-driven → Cart abandonment alerts

💳 Fintech

  • Event-driven → Fraud scoring
  • CDC → Transaction replication
  • Micro-batch → Compliance reports

📊 SaaS Analytics

  • CDC → Product events from DB
  • Micro-batch → DAU / MAU metrics
  • Event-driven → In-app notifications

⚠️ 7. Common Real-Time ETL Mistakes

❌ Treating everything as event-driven

❌ Using CDC where batch would work

❌ Ignoring replay & backfills

❌ Mixing patterns in one job

❌ No clear latency contracts

Anti-pattern example:
Using event-driven ETL to compute rolling revenue metrics directly for dashboards.
Result: incorrect aggregates, missed late events, expensive state rebuilds, and unreproducible numbers during incidents.

Mentor rule:
Every real-time pipeline must declare:
Expected latency
Replay strategy
Failure behavior
If not, it’s not production-ready.

🧠 8. Choosing the Right Pattern (Decision Guide)

  • Need sub-second reactions? → Event-Driven
  • Need analytics + scale? → Micro-Batch
  • Need correctness from DBs? → CDC
  • Need all three? → Use all three, deliberately

Real-time ETL is not about speed.
It’s about predictability under failure.


⏱️ 9. Define a Latency Contract (Or Your Pipeline Will Fail)

“Real-time” means nothing without a contract.

Every real-time ETL pipeline must explicitly define:

  • Expected latency (p50 / p95 / worst-case)
  • Acceptable delay during failures
  • What happens when SLAs are missed
  • Whether late data is dropped, corrected, or reprocessed

Example latency contracts

  • Event-driven ETL
    → p95 < 500 ms
    → Late events trigger compensating actions
  • Micro-batch ETL
    → Data freshness < 1 minute
    → Late data updates aggregates in next window
  • Log-based ETL (CDC)
    → Replication lag < 30 seconds
    → Backfills allowed via replay / time travel
Mentor rule:
If your pipeline cannot state its latency contract,
it is not production-ready — it’s a demo.

🧯 10. Failure & Recovery Patterns (The Part Everyone Ignores)

Real-time ETL doesn’t fail cleanly.
It fails under load, during deploys, and at 3 a.m.

Here’s how each pattern recovers.

Event-Driven ETL

  • Failures propagate instantly
  • Requires idempotent consumers
  • Needs replay topics or dead-letter queues

Recovery strategy:
Replay events + rebuild state

Micro-Batch ETL

  • Jobs retry naturally
  • Partial batches can be recomputed
  • Easier rollback

Recovery strategy:
Re-run failed windows

Log-Based ETL (CDC)

  • Offset-based recovery
  • Exactly-once semantics possible
  • Time travel simplifies fixes

Recovery strategy:
Resume from last committed log offset

Mentor truth:
Choose the pattern whose failure mode your team can actually handle.

🧠 11. What Senior Data Teams Do Differently

Junior teams ask:

“Which real-time ETL pattern should we use?”

Senior teams ask:

“Where should real-time stop?”

What senior teams get right:

  • Not everything needs to be real-time
  • Analytics latency ≠ application latency
  • CDC feeds systems of record, not dashboards directly
  • Event-driven pipelines are isolated from analytics
  • Micro-batch is the default unless proven otherwise
Final mentor insight:
Real-time ETL is a scalpel, not a hammer.
Use it precisely — or bleed complexity.

🧠 Conclusion

Real-time ETL is not one thing — it’s a toolbox.

Event-driven ETL gives you speed.
Micro-batch ETL gives you stability.
Log-based ETL gives you truth.

Great data platforms don’t argue about which is best.
They use the right pattern in the right place — and sleep better at night.


🔥 Next in Series

Next up: “Dimensional Data Modeling: Star, Snowflake, Data Vault (With Real Examples)”


🔔 Follow for More

Follow TheDataForge for high-signal deep dives on Spark, Kafka, Streaming, Lakehouse, and real-world data engineering — no fluff, only engineering truth.

⚡️Let’s connect — I post daily Big Data & Spark insights at DataForgeX on X.

💬 Comment Below:Which real-time ETL pattern are you using today — and where does it hurt the most?


🏷️ Tags

#DataEngineering #RealTimeETL #Streaming #Kafka #CDC #SparkStructuredStreaming #Lakehouse #EventDriven #BigData