Kafka Connect vs Debezium

How They Fit and When to Use Each

Kafka Connect runs connectors, and Debezium supplies the change data capture connectors that most teams run on it, so the two are not competing tools. The practical choices are log-based capture vs polling, and Debezium on Kafka Connect vs Debezium Server.

Last updated: Proudly published by: Jeff Wahl7 min read

Kafka Connect vs Debezium: the short answer

Kafka Connect and Debezium are not alternatives. Kafka Connect is the framework that runs connectors, and Debezium is a set of change data capture connectors that runs on it. The real decisions sit underneath: log-based capture (Debezium) or polling (the JDBC source connector), and Debezium on Kafka Connect or Debezium without it.

The Debezium architecture documentation names 3 ways to run Debezium. The one it calls the most common is source connectors in Kafka Connect; the others are Debezium Server and the Debezium Engine, a Java library you embed in your own application. This page uses the 3.7 documentation, the latest stable release when it was written.

Prepare for the interview
01 / Open invite
02min.

Know Kafka Connect vs Debezium the way the interviewer who asks it knows it.

a Kafka Connect vs Debezium query, the same shape a screen would give you.
The diff against expected. Where ties broke. What you missed.
sandbox
1source → bronze → silver → gold
2 ingest : CDC + Kafka
3 transform : dbt + Airflow
4 serve : Snowflake
5
Execute your solution0.4s avg.
DatabricksInterview question
Solve a Kafka Connect vs Debezium problem

How Debezium runs inside Kafka Connect

A Kafka Connect worker is a process that hosts connectors and their tasks. The Debezium connector sits at the source end: it reads the database's change log and hands records to the worker, which applies any configured transforms, serializes them with a converter and writes them to Kafka topics.

Postgres write-ahead log feeds a Debezium connector that runs inside a Kafka Connect worker; the worker applies a transform and a converter, then writes to a Kafka topicPostgres write-ahead log feeds a Debezium connector that runs inside a Kafka Connect worker; the worker applies a transform and a converter, then writes to a Kafka topic

That split is the whole relationship. Debezium owns what is specific to a database: how to read its log, how to take a snapshot, what a change event looks like. Kafka Connect owns what's common to every connector: it schedules tasks and stores offsets, and it serializes records and exposes a management API.

What Kafka Connect does

Kafka Connect moves data between Kafka and other systems through reusable connectors, so each integration is configuration instead of a bespoke consumer or producer. The Kafka Connect documentation describes 2 modes. In standalone mode all work runs in a single process, which is simple but has no fault tolerance. In distributed mode workers balance connectors and tasks among themselves, and you can scale the group up or down. Configs and offsets live in Kafka topics, and statuses are stored there too. Connectors are managed through a REST API that listens on port 8083 by default.

Connectors can apply transformations, which the documentation limits to lightweight message-at-a-time changes. A sink connector can route records it fails to process to a dead letter queue topic, set with errors.deadletterqueue.topic.name. None of this is specific to CDC: the same runtime hosts connectors that write Kafka topics to object storage, or to search indexes and warehouses.

Kafka Connect also offers exactly-once delivery for source connectors, since Apache Kafka 3.3.0 and in distributed mode only, switched on with the worker setting exactly.once.source.support. A connector has to support it, so check the connector before counting on it.

Debezium on Connect, JDBC polling and Debezium Server compared

Debezium on Connect
  • Reads changes fromDatabase log
  • Needs KafkaYes
  • Runs asConnect connector
  • Offsets kept inConnect offsets topic
  • Connectors per processMany
  • DeletesEmitted as events
JDBC source on Connect
  • Reads changes fromPolled query
  • Needs KafkaYes
  • Runs asConnect connector
  • Offsets kept inConnect offsets topic
  • Connectors per processMany
  • DeletesNot by polling alone
Debezium Server
  • Reads changes fromDatabase log
  • Needs KafkaNo
  • Runs asStandalone app
  • Offsets kept inFile by default
  • Connectors per process1
  • DeletesEmitted as events

Log-based capture vs polling: what Debezium adds

A polling connector runs a query on a schedule, for example every row whose updated_at is newer than the last value it saw. It can only report rows that exist when the query runs. A row deleted between polls is invisible, 2 updates between polls collapse into 1, and the query adds load to the source database on every cycle.

Debezium reads the transaction log instead. For PostgreSQL that is logical decoding through a replication slot, with the pgoutput plug-in that ships with PostgreSQL 10 and later. Every committed change becomes an event with a key and the row before and after the change. Each event also has an op code and a source block that carries the log position. Updates and deletes arrive as they happened, in log order, with no query against your tables.

The first start takes a snapshot so consumers begin with the current rows. The PostgreSQL connector's default snapshot mode is initial: it snapshots when no stored offset exists, then streams from the recorded log position. Downstream, the ExtractNewRecordState transform flattens the envelope to just the new row for sinks that expect plain records, and a delete produces a delete event followed by a tombstone record that lets Kafka log compaction drop the key.

The same Debezium connector on Kafka Connect and on Debezium Server

JSONorders-connector.json
{
  "name": "orders-connector",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "plugin.name": "pgoutput",
    "database.hostname": "db.internal",
    "database.dbname": "shop",
    "topic.prefix": "shop",
    "table.include.list": "public.orders",
    "transforms": "flatten",
    "transforms.flatten.type": "io.debezium.transforms.ExtractNewRecordState"
  }
}

Posted to the Connect REST API

Debezium Server and the embedded engine: Debezium without Kafka Connect

Debezium Server runs 1 source connector per instance and streams its events directly to targets such as Amazon Kinesis, Google Cloud Pub/Sub, Apache Pulsar, Redis Streams, RabbitMQ and Kafka itself, all of which the documentation lists. It takes the offset storage that Connect would otherwise provide and defaults to a file, with in-memory and JDBC alternatives, and Redis too.

There is no Connect REST API, no group of workers rebalancing tasks and no other connectors in the same runtime. Connectors that keep a schema history, which includes MySQL, Oracle, SQL Server and Db2, default to storing it in Kafka, so a deployment without Kafka must configure another store. The embedded engine goes further and puts the connector inside your own Java process, which fits when change events feed 1 application and a separate runtime is overhead.

What it costs to operate Debezium

Log-based capture moves cost from query load to log retention. On PostgreSQL, the replication slot is guaranteed to retain all WAL entries Debezium still needs, even during a connector outage, according to the Debezium PostgreSQL connector documentation. A connector that stays down while the source keeps writing makes the database hold more and more WAL on its own disk.

Watch 2 columns of pg_replication_slots: confirmed_flush_lsn, how far the connector has received, and restart_lsn, how far the database can reclaim. If the first keeps advancing while the second lags, the database isn't reclaiming space. A table that rarely changes can cause this, and the documented remedy is periodic heartbeat events through heartbeat.interval.ms.

Plan for duplicates as well. The Debezium FAQ says consumers see each event once in normal operation, and at least once after a crash. Make sinks idempotent by deduplicating on the primary key and the log position in the event's source block, and treat Connect's exactly-once setting as a help for the connector side, not a guarantee for the whole pipeline.

Which setup fits which situation

Debezium on Kafka Connect fits when you already run Kafka, need every change in order with deletes included, or want several sources and sinks managed in 1 runtime with a REST API. The cost is a Connect cluster and a log-retention habit on each source database.

A polling connector fits when the table has a reliable updated_at and deletes are soft or irrelevant. It also fits when you can't enable logical replication on the source or an approximate copy refreshed every few minutes is enough. It is simpler to grant access for, and it gives up deletes and intermediate states.

Debezium Server fits when the destination is Kinesis or a comparable service such as Pub/Sub, and standing up Kafka only to carry change events is not worth it. The embedded engine fits when 1 application consumes the changes itself. Each of these trades the Connect runtime for less infrastructure and fewer features, so pick by what your destination and your team already run.

If the choice comes up in an interview, it is usually inside a design question: how do you keep a warehouse or search index in sync with an operational database. The CDC pipeline interview questions cover that ground, and the system design round guide shows how to structure the answer. For the batch side of the same tradeoff, see batch vs streaming pipelines.

Practise CDC and streaming design

Interviewers ask about change data capture to see whether you understand how ordering and deletes behave and how snapshots and replay work, not whether you know tool names. Work through the data pipeline interview questions and the data pipeline practice problems, and compare the transport choices in Kafka vs Kinesis.

Kafka Connect vs Debezium FAQ

Is Debezium the same as Kafka Connect?+
No. Kafka Connect is the framework and runtime that runs connectors. Debezium is a set of source connectors, 1 per database, that most teams run inside Kafka Connect. Debezium can also run without Connect: Debezium Server is a standalone runtime, and an embedded engine puts it inside a Java application.
Does Debezium require Kafka Connect?+
Not always. Debezium runs on Kafka Connect in its most common setup, but Debezium Server streams change events to targets such as Amazon Kinesis, Google Cloud Pub/Sub or Apache Pulsar without Kafka, and the Debezium Engine embeds the same connectors in your own Java application.
What is the difference between Debezium and the Kafka Connect JDBC connector?+
The JDBC source connector polls the database with queries, so it sees the rows that exist when it asks. Debezium reads the database's transaction log, so it emits every committed change in order, deletes included, with the row before and after the change.
Does Debezium deliver each change exactly once?+
Not after a crash. The Debezium FAQ says consumers see each event once in normal operation and at least once after a failure, so a sink can receive the same row change twice after a restart. Kafka Connect itself supports exactly-once for source connectors since Apache Kafka 3.3.0, in distributed mode only.
Can Kafka Connect do change data capture without Debezium?+
Yes, with other connectors, including vendor-built log-based ones and the polling JDBC source. Debezium is the best-known open-source log-based option, which is why the 2 names are used together.
Which databases does Debezium support?+
Its documentation lists source connectors for MySQL, MariaDB, MongoDB, PostgreSQL, Oracle, SQL Server and Db2. Cassandra is there too, plus others such as Vitess and Spanner. It also has JDBC and MongoDB sink connectors.
What can go wrong when running Debezium on PostgreSQL?+
The replication slot keeps every WAL segment the connector still needs, even while the connector is down, so a stopped connector can fill the database's disk. Monitor the slot's confirmed_flush_lsn and restart_lsn, and set heartbeat.interval.ms so a quiet table doesn't hold WAL back.
02 / Why practice

The candidate who gets the offer

  1. 01

    Reading a solution is not the same as writing one

    Every engineer who has frozen on a query they had read a dozen times knows the gap. The only preparation that closes it is producing the answer yourself, under time, before the interview does it for you

  2. 02

    76% of hiring managers reject on the coding task, not the resume

    From HackerRank's 2024 Developer Skills Report. Candidates who look strong on paper still fail the live screen if they haven't done timed, executable practice

  3. 03

    System design comes down to the calls you defend out loud

    Ingestion, batch vs streaming, the bronze/silver/gold layers, idempotency, backfill and replay. Sketching the pipeline and naming the failure modes is the signal, not the boxes

Related guides