Change Data Capture (CDC) • CDC Fundamentals & Use CasesMedium⏱️ ~3 min
CDC at Scale: Architecture and Real World Implementation
The Complete Data Flow: In a production system, CDC is the connective tissue between operational databases and the entire data ecosystem. Understanding this end to end architecture is critical for system design interviews.
Consider an ecommerce platform processing 5,000 to 20,000 writes per second at peak. The primary PostgreSQL database commits a transaction that inserts a new order and updates inventory. Within 200 to 500 milliseconds, a log based CDC connector like Debezium reads the WAL, parses the committed transaction, and converts each row change into a structured event containing the table name, primary key, operation type (INSERT, UPDATE, DELETE), before and after images, transaction ID, and commit timestamp.
These events are published to a distributed message bus, typically Apache Kafka or AWS Kinesis. The bus must handle hundreds of thousands of events per second with p99 append latency in the single digit milliseconds. Events are partitioned by primary key to preserve per entity ordering while enabling horizontal scaling. With 64 partitions, you can easily sustain 200,000 events per second.
Downstream Consumers (Multiple Use Cases): The power of CDC is that multiple heterogeneous consumers process the same stream independently:
A stream processor maintains a materialized view of real time inventory, pushing updates into Redis with under 1 second lag. This cache serves product page reads at 1 million queries per second.
An aggregation pipeline batches events every 1 to 5 minutes and loads them into a columnar data warehouse like Snowflake or BigQuery for business intelligence queries.
A search indexing service consumes CDC events to keep Elasticsearch synchronized with product catalog changes, achieving index freshness within 2 to 3 seconds.
A fraud detection system analyzes order patterns in real time, making decisions within 200 milliseconds p99.
Real World Scale Examples: At companies like Netflix and Uber, CDC powers mission critical data flows. Uber processes tens of millions of CDC events per minute across trip updates, driver locations, and payment transactions. Different consumers have varying latency requirements: driver matching needs under 500 milliseconds end to end, while financial reporting can tolerate 5 to 15 minutes of lag.
Netflix uses CDC to synchronize operational data stores with feature stores for machine learning recommendations and to maintain search indexes across multiple regions. The key architectural decision is partitioning the CDC stream appropriately: partition by user ID for user facing services, by content ID for catalog updates, and by region for geo distributed consumers.
CDC Pipeline Throughput
200k/sec
KAFKA EVENTS
3ms
P99 LATENCY
"CDC is not a point feature of the database. It's an architectural pattern that decouples data producers from many heterogeneous consumers while preserving ordering, correctness, and reasonable freshness at scale."
💡 Key Takeaways
✓CDC architectures use a message bus (Kafka, Kinesis) as the central hub, allowing multiple consumers to process the same stream independently
✓Partitioning by primary key preserves per entity ordering while enabling horizontal scaling to hundreds of thousands of events per second
✓Different consumers have different latency requirements: caches need subsecond lag, fraud detection needs under 500ms, warehouses can tolerate 5 to 15 minutes
✓At scale, CDC handles tens of millions of events per minute with p99 end to end latency under 1 second for real time use cases
📌 Examples
1Uber CDC pipeline processing 10 million events per minute from trip updates, driver locations, and payments, with driver matching requiring under 500ms end to end latency
2Ecommerce platform CDC feeding Redis cache (1 sec lag, 1M QPS), Elasticsearch (2 sec lag), Snowflake warehouse (5 min batches), and fraud system (200ms p99)