Kafka interview questions: answers checked against the docs
Core Apache Kafka questions for data engineering and back-end roles, answered in plain words and checked against the official Kafka documentation.
Kafka interviews cover topics, partitions and offsets, ordering by key, consumer groups and rebalancing, replication and the in-sync replica set, acks and min.insync.replicas, delivery semantics, offset commits, idempotent and transactional producers, log compaction, KRaft, and when to use Kafka Connect or Kafka Streams. Below are 15 questions; each answer lists the Apache Kafka 4.4 documentation pages it was checked against.
Basic Kafka interview questions
Basic1. What is Kafka, and how is it different from a traditional message queue?
Kafka is a distributed event streaming platform: producers append events to topics, and consumers read them. The key difference from a classic queue is that reading does not delete anything. Events stay for a configured retention period, so several independent consumers can read the same topic, and a consumer can re-read history by moving its position back. Kafka 4.x also offers share groups for queue-like work, where consumers share records and acknowledge them one by one.
Checked against: Apache Kafka 4.4 docs: design, Apache Kafka 4.4 docs: introduction
Basic2. What are topics, partitions and offsets?
A topic is a named stream of events. It is split into partitions, which are spread across brokers so reads and writes scale out. Each partition is an append-only log, and every event in it has a sequential offset. A consumer's progress in a partition is simply the offset of the next event it will read.
Checked against: Apache Kafka 4.4 docs: design, Apache Kafka 4.4 docs: introduction
Basic3. Does Kafka keep messages in order?
Only within a partition: a consumer reads a partition's events in the order they were written. There is no total order across partitions of a topic. To keep related events in order (all events for one customer, say), give them the same key, because events with the same key go to the same partition. Changing the number of partitions later changes where keys land.
Checked against: Apache Kafka 4.4 docs: introduction
Basic4. What is a consumer group?
A set of consumers that share the work of reading a topic. Each partition is assigned to exactly one consumer in the group at a time, so a group can have at most as many active consumers as there are partitions; extra consumers sit idle. Different groups read independently, each with its own offsets, which is how several applications consume the same topic. Kafka 4.x also has share groups, a different kind of group: partitions can be assigned to several share consumers, so their number can exceed the partition count.
Checked against: Apache Kafka 4.4 docs: design
Basic5. Is Kafka push-based or pull-based?
Producers push events to brokers, and consumers pull from brokers. Pulling lets each consumer read at its own pace, catch up after a pause and fetch in batches, instead of the broker deciding the rate. Consumers that fall behind show up as consumer lag, which is one of the main metrics to monitor.
Checked against: Apache Kafka 4.4 docs: design
Intermediate Kafka interview questions
Intermediate6. How does replication work, and what is the ISR?
Each partition has one leader replica and follower replicas on other brokers; the replication factor sets how many copies exist (3 is a common production setting). The in-sync replicas (ISR) are the replicas that are caught up with the leader. A message counts as committed once every replica in the ISR has it, and committed messages survive as long as one in-sync replica stays alive.
Checked against: Apache Kafka 4.4 docs: design, Apache Kafka 4.4 docs: introduction
Intermediate7. How do acks and min.insync.replicas decide durability?
acks is a producer setting: acks=0 does not wait for the broker at all, acks=1 waits for the leader only, and acks=all waits for the full in-sync replica set. min.insync.replicas is a topic or broker setting: with acks=all, a write fails if fewer than that many replicas are in sync. A common durable setup is replication factor 3, min.insync.replicas 2 and acks=all, which tolerates one broker failure without losing acknowledged writes.
Producer and topic configuration snippet · illustrative, not run on this page# producer
acks=all
# topic
replication.factor=3
min.insync.replicas=2Checked against: Apache Kafka 4.4 docs: producer configs, Apache Kafka 4.4 docs: topic configs
Intermediate8. What are at-most-once, at-least-once and exactly-once delivery?
At most once: messages can be lost but are never redelivered (for example, committing the offset before processing). At least once: nothing is lost but messages can be processed twice (process, then commit; a crash in between replays the message). Exactly once: each message's effect happens once. Without transactions, the practical default is at-least-once with consumers that can handle duplicates.
Checked against: Apache Kafka 4.4 docs: design
Intermediate9. How do consumers commit offsets, and what is the risk of auto-commit?
With enable.auto.commit=true (the default), offsets are committed periodically. In a normal loop that finishes processing each batch before polling again, a crash means the records since the last commit are delivered again, so the risk is duplicates; consumers should handle reprocessing. Records can be skipped only when processing is handed off asynchronously, for example to other threads, so offsets are committed before the work is done. Committing manually after the work, as in the loop below, makes the at-least-once behavior explicit.
Java consumer snippet · illustrative, not run on this pageprops.put("enable.auto.commit", "false");
while (running) {
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(500));
for (ConsumerRecord<String, String> r : records) {
process(r); // do the work first
}
consumer.commitSync(); // then record progress
}Checked against: Apache Kafka 4.4 docs: consumer configs, Apache Kafka 4.4 docs: design
Intermediate10. What is an idempotent producer?
When a producer retries after a timeout, the first attempt may in fact have succeeded, which would write a duplicate. With idempotence enabled, the broker recognizes retried batches and writes each message once per partition. It is on by default unless conflicting settings are configured, and it requires acks=all.
Producer configuration snippet · illustrative, not run on this pageenable.idempotence=true
acks=allChecked against: Apache Kafka 4.4 docs: design, Apache Kafka 4.4 docs: producer configs
Advanced Kafka interview questions
Advanced11. How do transactions give exactly-once processing?
In a consume-process-produce application, a transactional producer writes its output records and the consumer's offsets in one transaction, so either all of them become visible or none do. Downstream consumers set isolation.level=read_committed to see only committed transactions. Kafka Streams builds on this. This covers what happens inside Kafka; writes to external systems need their own idempotency.
Java producer snippet · illustrative, not run on this pageproducer.initTransactions();
producer.beginTransaction();
producer.send(new ProducerRecord<>("orders-enriched", key, value));
producer.sendOffsetsToTransaction(offsets, consumer.groupMetadata());
producer.commitTransaction();Checked against: Apache Kafka 4.4 docs: consumer configs, Apache Kafka 4.4 docs: design
Advanced12. What is log compaction?
With cleanup.policy=compact, Kafka keeps at least the latest value for each key in a partition and removes older values for that key over time, instead of deleting by age. That suits changelog-style topics such as the current state of each customer. A record with a null value (a tombstone) marks a key for deletion.
Topic configuration snippet · illustrative, not run on this pagecleanup.policy=compactChecked against: Apache Kafka 4.4 docs: design, Apache Kafka 4.4 docs: topic configs
Advanced13. What happens during a consumer group rebalance, and what changed recently?
When consumers join or leave, or partitions change, the group reassigns partitions. With the classic protocol this could pause consumption across the whole group. The newer consumer group protocol (KIP-848) is incremental and coordinated by the broker, which shortens rebalances. Either way, keep processing per poll short, so a slow consumer is not removed from the group.
Checked against: Apache Kafka 4.4 docs: consumer rebalance protocol
Advanced14. What is KRaft, and what replaced ZooKeeper?
Kafka 4.x runs only in KRaft mode: Kafka manages cluster metadata itself, with some servers acting as controllers that run a Raft-based metadata quorum and others acting as brokers (a server can also be both). Older clusters used Apache ZooKeeper for this. A ZooKeeper cluster cannot upgrade straight to 4.x: it first migrates to KRaft on a bridge release, the last of which is Kafka 3.9. Expect questions on controller quorum sizing and the migration.
Checked against: Apache Kafka 4.4 docs: KRaft, Apache Kafka 4.4 docs: KRaft vs ZooKeeper
Advanced15. When would you use Kafka Connect or Kafka Streams?
Kafka Connect moves data between Kafka and other systems (databases, object storage, search) with reusable source and sink connectors, without custom code. Kafka Streams is a Java library for processing data in Kafka (filtering, joining, aggregating, windowing) inside your own application. When asked to scale a cluster, mention that new brokers do not take existing partitions automatically: you move them with the partition reassignment tool.
Checked against: Apache Kafka 4.4 docs: Kafka Connect, Apache Kafka 4.4 docs: basic operations, Apache Kafka 4.4 docs: Streams core concepts
How to practice with this page
- Draw a topic with partitions, a consumer group and offsets before answering ordering or scaling questions.
- Explain each durability setting by what happens when a broker fails.
- Run a local Kafka quickstart and produce and consume a few keyed messages.
- Prepare one design story: why Kafka, which keys, how many partitions, and what you monitored.
Related interview prep and tools
The language of the official Kafka clients.
Open →QuestionsSystem design interview questionsQueues, streams and trade-offs at scale.
Open →QuestionsDatabricks interview questionsLakehouse and Delta Lake questions, checked against the docs.
Open →QuestionsSpring Boot interview questionsBack-end services that often produce to Kafka.
Open →Free toolResume summary generatorDraft a summary for a Data Engineer role; the title is filled in, you add your experience.
Open →Free toolLinkedIn headline generatorWrite a headline for a Data Engineer search.
Open →Disclosure: TryHired makes HIRED, a paid job-search program, so we have a conflict of interest when we mention it. This question bank is free, with no TryHired signup.
Questions people ask
What Kafka topics come up often in interviews?
Do I need Java for a Kafka interview?
Is Kafka the same as a managed service such as Amazon MSK or Confluent Cloud?
How this page is built
TryHired wrote these questions and answers. Statements about the technology were checked against the official documentation pages listed below, saved when the page was built (2026-11-15). The code snippets are short illustrations and were not run on this page. The question list is general practice: it does not predict what a particular employer will ask.
- Interviewers ask different questions for different roles and levels.
- Answers are short explanations, not complete references.
- No Kafka cluster or JVM was available on the build machine, so nothing was run on this page; check settings against the Kafka version you use, because defaults change between releases.
- Apache Kafka 4.4 docs: Kafka Connect (read 2026-11-15)
- Apache Kafka 4.4 docs: consumer configs (read 2026-11-15)
- Apache Kafka 4.4 docs: design (read 2026-11-15)
- Apache Kafka 4.4 docs: introduction (read 2026-11-15)
- Apache Kafka 4.4 docs: KRaft (read 2026-11-15)
- Apache Kafka 4.4 docs: basic operations (read 2026-11-15)
- Apache Kafka 4.4 docs: producer configs (read 2026-11-15)
- Apache Kafka 4.4 docs: consumer rebalance protocol (read 2026-11-15)
- Apache Kafka 4.4 docs: Streams core concepts (read 2026-11-15)
- Apache Kafka 4.4 docs: topic configs (read 2026-11-15)
- Apache Kafka 4.4 docs: KRaft vs ZooKeeper (read 2026-11-15)