Kafka Interview Questions for Data Engineers (2026)
Sixteen Kafka questions asked in real Indian data engineering interviews — from partitions and consumer groups to exactly-once transactions and KRaft — each answered the way a strong candidate would in the room.
By Durgesh Yadav — Senior Data Engineer @ 7-Eleven · Updated 19 Oct 2026. Preparation guidance, not a hiring guarantee.
What are the most common Kafka interview questions?
Kafka interviews concentrate on partitions and consumer groups, replication with ISR and min.insync.replicas, delivery semantics from at-most-once to exactly-once, idempotent producers, log compaction, rebalancing, and Kafka Connect. Expect scenario questions like preventing duplicates during consumer failure and preserving ordering per key. Strong answers name concrete configs — acks=all, enable.idempotence, transactional.id — not just definitions.
Nearly every Kafka round opens with partitions, offsets, and consumer groups, then immediately tests whether you understand replication. Interviewers listen for precision: the partition is both the unit of ordering and the unit of parallelism, and durability is a three-config contract, not a single flag.
Partitions, offsets, and why consumer count is capped by partition count
Leader/follower replication, the ISR, and the high watermark
acks settings and the RF=3 + min.insync.replicas=2 durability recipe
When do you write a Kafka consumer, use Connect, or use Kafka Streams?
Indian DE loops ask this as 'how would you land Postgres changes in the warehouse'. The answer is Connect with Debezium and a sink connector; writing a consumer for that is a red flag. Streams is right once you need windows, joins or state inside Kafka, and a plain consumer is right when the logic belongs to a service.
Write code only where the logic is yours
Dimension
Plain consumer
Kafka Connect
Kafka Streams
Job it does
Whatever your code does with each record
Moves data between Kafka and external systems
Transforms and aggregates topic to topic
Code you write
Poll loop, error handling and offset commits
Configuration; a connector only if none exists
A topology in the Streams DSL or Processor API
Runs on
Your own service instances
Connect workers, standalone or distributed
Your own application instances, no extra cluster
Scales by
Consumers in a group, capped by partitions
Tasks spread across workers
Threads and instances, capped by partitions
Exactly-once
You build it with the transactional API
Depends on the connector
Built in through processing.guarantee
Reach for it when
Business logic reacts to events
CDC from a database, sinks into a warehouse
Windowed counts, joins and stateful enrichment
Why do delivery semantics separate senior candidates?
Anyone can name at-least-once; strong candidates can point to the exact failure window that creates duplicates and the config that closes it. Expect a scenario like 'your consumer crashed mid-batch — what happens?' followed immediately by 'now make the pipeline exactly-once.'
Producer retries and consumer commit ordering as the two duplicate sources
Idempotent producer: PID plus sequence numbers, default since Kafka 3.0
Transactions, sendOffsetsToTransaction, and read_committed consumers
What operations and ecosystem topics round out the loop?
Product companies and GCCs in India increasingly probe operational maturity: what a rebalance storm looks like, how compacted topics back CDC pipelines, and whether you know the platform post-ZooKeeper. Connect and Schema Registry questions test whether you have built real pipelines or only read about them.
Rebalance triggers, cooperative sticky assignment, and static membership
Kafka Connect source/sink model and Debezium-based CDC
Schema Registry compatibility modes and the KRaft metadata quorum
Kafka interview questions and answers: the eight that decide the round
Kafka questions test whether you have run it, not whether you have read about it. The topics repeat: what a partition is for, how consumer groups share work, what happens on a rebalance, and how a producer and consumer together get exactly-once. The answers below are the version that survives a follow-up.
Topic, partition, offset: what each one is for
How a consumer group divides partitions
acks=0, 1 and all
Message ordering guarantees
Retention and compaction
Where the message went when the consumer restarted
Why partitions?
A partition is the unit of parallelism and ordering: one ordered, append-only log that exactly one consumer in a group reads. More partitions mean more consumers can read in parallel and more throughput; the price is ordering only within a partition and more open files and leader elections on the brokers.
What happens when a fourth consumer joins a group on a three-partition topic?
Nothing useful: a partition is assigned to at most one consumer in a group, so the fourth sits idle. The rebalance itself pauses consumption for the group while partitions are reassigned; cooperative rebalancing keeps the unaffected consumers reading.
acks=0, 1 or all
0: the producer does not wait, so a broker crash loses messages. 1: the leader acknowledges once it has written, so a leader crash before replication loses them. all (with min.insync.replicas of 2 or more): every in-sync replica has the message before the ack. Pipelines that must not lose data run acks=all with idempotence on.
How is ordering guaranteed?
Only within a partition. Messages with the same key hash to the same partition, so 'all events for order 123 in order' is achieved by keying on the order id. With retries and max.in.flight above 1, ordering can break unless enable.idempotence is true, which is the default from 3.0.
The consumer restarted; did it lose or repeat messages?
It depends on when offsets were committed. Auto-commit every five seconds means up to five seconds of messages are replayed after a crash (at-least-once). Committing before processing gives at-most-once. Commit after processing, and make the processing idempotent, is the answer for data pipelines.
Retention vs compaction
Time or size retention deletes old segments regardless of key; log compaction keeps the latest value per key forever, which turns a topic into a changelog you can replay to rebuild state. A CDC topic keyed on primary key is the standard example of compaction.
Exactly-once, in one breath
Idempotent producer (no duplicates from retries) plus transactions (produce and commit offsets atomically) plus consumers reading with isolation.level=read_committed. It is exactly-once inside Kafka; to a downstream database it is still your upsert that makes it exactly-once.
Kafka against a queue like RabbitMQ
Kafka keeps messages after they are read, so many consumer groups can replay the same log independently and a new system can start from the beginning; a queue deletes on delivery. Kafka trades per-message routing and priorities for throughput and replay.
What do Kafka interview questions for experienced candidates (3 to 6 years) look like?
At three years the interviewer stops asking what a partition is and starts asking what you did at 2 a.m. The questions become incidents: consumer lag climbing, a broker down, a topic that needs more partitions, a producer that suddenly sends duplicates. Good answers name the metric you looked at, the config you changed, and what it cost.
Consumer lag is growing: read, then act
A broker died: what the clients saw and what you did
Adding partitions to a keyed topic, and why it breaks ordering
Schema changes without breaking consumers
Sizing: how many partitions, what retention, which compression
Lag is growing on one consumer group
First check whether one partition or all are lagging (a hot key versus general slowness), then whether the consumer is processing slowly (poll interval, a slow downstream call) or rebalancing in a loop (max.poll.interval.ms exceeded). Fixes in order: batch the downstream call, raise max.poll.interval.ms, add consumers up to the partition count, then add partitions.
We added partitions and the order of events broke
Because the key-to-partition mapping changed: order 123's events now land on a different partition than its older events, so a consumer can see them out of sequence during the transition. Plan partitions up front for keyed topics, or migrate to a new topic and switch producers and consumers together.
A broker went down
Partitions it led elected new leaders from the ISR; producers with acks=all stalled on any partition where min.insync.replicas could not be met until it recovered; consumers reconnected to the new leaders. Under-replicated partitions is the metric; unclean.leader.election stays false unless losing data is acceptable.
Changing a message schema safely
A schema registry with backward compatibility: add optional fields with defaults, never rename or remove, and deploy consumers that tolerate the new field before producers send it. Say how you would run both versions during the rollout.
Deck 04, Real-Time, for Real, covers the kafka and streaming round. Streaming rounds go past "use Kafka". What happens when a broker dies, why consumers keep rebalancing, why a watermark won't advance, and how to get exactly-once results. Then three real-time designs.
Real questions from beginner to advanced, each with a concise model answer — practice them, then rehearse live in a mock interview. Every answer is open; collapse any you have already covered.
EasyWhat is Apache Kafka, and why is it preferred over a traditional message broker like RabbitMQ for data pipelines?
Kafka is a distributed, append-only commit log for publishing and subscribing to streams of events. Unlike a traditional broker, messages are not deleted on consumption — they are retained for a configured period, so multiple independent consumer groups can replay the same data. Combined with partitioned horizontal scaling and sequential disk I/O, this makes it the standard backbone for CDC, event-driven microservices, and streaming ETL.
EasyExplain topics, partitions, and offsets.
A topic is a named stream of events, split into partitions that are the unit of both parallelism and ordering. Each partition is an ordered, immutable log where every record gets a monotonically increasing offset. Consumers track their position by committing offsets, which is how Kafka supports replay — you can seek back to any retained offset and reprocess.
EasyWhat is a consumer group, and what happens if there are more consumers than partitions?
A consumer group is a set of consumers sharing a group.id that divide a topic's partitions among themselves, with each partition assigned to exactly one consumer in the group. This gives queue semantics within a group and pub-sub semantics across groups. If consumers outnumber partitions, the extras sit idle — which is why partition count caps your consumption parallelism.
EasyHow long does Kafka keep messages, and does consuming a message delete it?
Retention is time- or size-based per topic (retention.ms, default 7 days, or retention.bytes) and completely independent of consumption — reading never deletes anything. A topic can alternatively use cleanup.policy=compact to keep the latest record per key indefinitely. This decoupling is what lets you re-run a broken pipeline simply by resetting consumer offsets.
EasyWhat do acks=0, acks=1, and acks=all mean for a producer?
acks=0 is fire-and-forget with no broker acknowledgement — fastest, but can silently lose data. acks=1 waits only for the partition leader to write locally, so data is lost if the leader dies before followers replicate. acks=all waits until all in-sync replicas have the record; combined with min.insync.replicas=2 it is the standard durability setting, and it has been the default since Kafka 3.0.
MediumWhat is the ISR, and how do acks=all and min.insync.replicas work together?
The in-sync replica set is the leader plus the followers that are fully caught up within replica.lag.time.max.ms. With acks=all, a write is acknowledged only after every ISR member has it; min.insync.replicas sets the floor — with replication factor 3 and min.insync.replicas=2, you tolerate one broker failure, and the producer gets NotEnoughReplicasException rather than a silent under-replicated write if a second one drops out. Consumers only see records up to the high watermark, i.e., what the full ISR has replicated.
MediumHow do at-most-once and at-least-once delivery actually arise in Kafka?
At-least-once is the default: producer retries after an ack timeout can write duplicates, and a consumer that commits offsets after processing will reprocess records if it crashes mid-batch. At-most-once comes from the opposite choices — a producer with retries disabled, or a consumer that commits before processing, so a crash loses the in-flight records. In interviews, tie each mode to the exact failure window rather than just naming the three semantics.
MediumHow does the idempotent producer eliminate duplicates from retries?
With enable.idempotence=true, the broker assigns the producer a PID, and the producer attaches a per-partition sequence number to every batch. On a retry, the broker recognizes a sequence it has already persisted and discards the duplicate; a gap raises OutOfOrderSequenceException. It is on by default since Kafka 3.0, but only covers a single producer session writing to a single partition — surviving restarts or spanning topics requires transactions.
MediumWhat ordering guarantees does Kafka give, and how do you keep per-entity ordering at high throughput?
Ordering is guaranteed only within a partition, never across a topic. You get per-entity ordering by keying messages (say, user_id), because the default partitioner hashes the key with murmur2 to a fixed partition. With idempotence enabled you can keep max.in.flight.requests.per.connection at up to 5 and the broker still preserves order across retries; without it, in-flight greater than 1 plus retries can reorder batches.
MediumWhat is log compaction, and when would you choose it over time-based retention?
With cleanup.policy=compact, background cleaner threads rewrite log segments keeping at least the latest value for each key, so the topic becomes a snapshot of current state rather than a bounded history. A record with a null value is a tombstone that deletes the key, retained for delete.retention.ms (24 hours by default) so consumers observe the delete. Use it for changelog-style data — CDC snapshots, Kafka Streams state store changelogs, and Connect's internal config and offset topics.
MediumWhat triggers a consumer group rebalance, and how does cooperative rebalancing improve on eager?
Rebalances fire when members join or leave, when a consumer misses session.timeout.ms heartbeats or exceeds max.poll.interval.ms between polls, or when partition count changes. The classic eager protocol revokes every partition from every member — a stop-the-world pause — while CooperativeStickyAssignor moves only the partitions that actually need to move, letting the rest keep consuming. Static membership via group.instance.id additionally avoids rebalancing on quick restarts, and Kafka 4.0's KIP-848 protocol makes this coordination broker-driven and incremental by default.
MediumWhat is Kafka Connect, and when do you use it instead of writing a custom consumer?
Connect is Kafka's framework for moving data between Kafka and external systems using pre-built source and sink connectors — Debezium for CDC from MySQL or Postgres, sinks for S3, Elasticsearch, or a warehouse. In distributed mode a cluster of workers splits connectors into parallel tasks, and offsets, configs, and status live in internal Kafka topics, so pipelines survive worker failure without custom code. Write a consumer only when you need business logic; for pure ingestion or egress, Connect with SMTs for light transforms is the right answer.
HardExplain how Kafka achieves exactly-once semantics end-to-end.
Exactly-once combines idempotent producers with transactions: a producer configured with a transactional.id wraps its output records and the consumed offsets in one atomic unit via sendOffsetsToTransaction(), so the consume-process-produce cycle commits or aborts as a whole. Downstream consumers must set isolation.level=read_committed to skip aborted records; in Kafka Streams this is just processing.guarantee=exactly_once_v2. The guarantee holds within Kafka-to-Kafka pipelines — once you write to an external system, you need idempotent or transactional sinks to extend it.
HardWhat is unclean leader election, and what happens if every replica in the ISR fails?
If all ISR replicas die, the partition is unavailable until either an ISR member returns or, with unclean.leader.election.enable=true, an out-of-sync follower is elected leader — restoring availability but permanently losing every message the old leader had that the follower did not. It is false by default because Kafka favours durability over availability here. The complete durability posture is RF=3, min.insync.replicas=2, acks=all, unclean election off — interviewers want the tradeoff articulated, not just the flag named.
HardHow does Schema Registry enforce compatibility, and which mode do you pick when evolving schemas?
Producers serialize against a schema registered in the registry and prepend a magic byte plus a 4-byte schema ID to each message; consumers fetch the schema by ID to deserialize. Compatibility modes gate registration: BACKWARD (the default) means readers on the new schema can decode old data — so you upgrade consumers first and may delete fields or add optional ones; FORWARD is the reverse, FULL is both, and the _TRANSITIVE variants check against all prior versions rather than just the latest. Picking the wrong mode is how one deploy breaks every downstream consumer.
HardWhat is KRaft, and how does it change Kafka's architecture compared to ZooKeeper?
KRaft (KIP-500) replaces ZooKeeper with a built-in Raft quorum of controller nodes that store all cluster metadata in an internal __cluster_metadata log, which brokers replay to stay current. This removes a second distributed system to operate, makes controller failover near-instant because standby controllers already hold the metadata, and raises the practical partition ceiling per cluster into the millions. ZooKeeper support was removed entirely in Kafka 4.0, so a 2026 answer should assume KRaft.
By company
Data Engineer interviews that ask these questions
See how this topic shows up in real Data Engineer loops — rounds, difficulty and company-specific questions:
Which Kafka topics matter most for data engineer interviews in India?
Partitions, consumer groups, and replication appear in virtually every round, whether services, GCC, or product. Services companies usually stay conceptual, while product companies and GCCs push into configs, exactly-once transactions, and debugging scenarios like consumer lag spikes or rebalance storms. If you have limited prep time, master delivery semantics end-to-end — it is the single highest-signal area.
Do I need hands-on Kafka experience, or is theory enough?
At 0–2 years, well-understood theory usually clears the bar. Beyond that, interviewers ask scenario questions — 'lag is growing on one partition, walk me through it' — that quickly expose reading-only preparation. Spinning up a single-broker KRaft cluster in Docker and reproducing a rebalance or a duplicate-delivery case is the fastest way to convert theory into credible answers.
Is ZooKeeper still asked in Kafka interviews in 2026?
Mostly as history. ZooKeeper support was removed entirely in Kafka 4.0, so current interviews expect you to describe the KRaft controller quorum and the __cluster_metadata log. Mentioning that you have operated both migrations is a plus at companies running older clusters, but never present ZooKeeper as the current architecture.
What do Kafka skills pay for data engineers in India?
This page quotes no pay figures. PrepNPlaced's India Tech Hiring Report found that fewer than 300 of its postings disclosed an INR salary, too few to publish honestly. Streaming experience still moves offers: engineers who can operate Kafka, not just consume from it, are the ones product companies and GCCs hire for mid-to-senior roles. Interviewers separate the two groups with the scenario and configuration questions on this page.
Next Step
Turn The Guide Into Practice
Use PrepNPlaced tools to turn this learning path into resume proof, targeted practice, and interview-ready explanations.