Intermediate LevelSystem Design & Architecture
What is Change Data Capture (CDC) and how does Debezium stream database mutations?
β Interview Prompt: Explain Change Data Capture (CDC), Debezium connector, tailing database transaction logs (binlog/WAL), and zero-query-overhead event streaming.
Change Data Capture (CDC) streams database row mutations ('INSERT', 'UPDATE', 'DELETE') into event brokers (Kafka) by tailing the database's native transaction log (MySQL binlog / Postgres WAL):
Advantages over DB Polling:
β’
Zero Application Changes: Captures DB mutations without application code changes.
β’
Zero Query Overhead: Tails log files on disk without executing heavy 'SELECT' queries on primary database tables.
β’
Captures Deletes: Reliable event detection for hard deletes.
Code Implementation Example
json
{
"before": { "id": 10, "status": "PENDING" },
"after": { "id": 10, "status": "SHIPPED" },
"op": "u",
"source": { "db": "orders", "table": "order_records" }
}π‘Debezium Change Data Capture (CDC) JSON event payload.
π― Interview Key Takeaway
Deploy Change Data Capture (CDC) with Debezium to stream database mutations into Kafka with zero performance impact on database query engines.
#System Design#CDC#Debezium#Kafka#Intermediate
Back to all System Design & Architecture Questionsβ