Skip to content
Apache Kafka interview 3 min read

Interview Questions

A curated set of Kafka interview questions, grouped by theme. Each answer is intentionally concise — enough to demonstrate understanding in an interview without drowning in detail.

Fundamentals

What is Apache Kafka? A distributed event streaming platform built on an append-only, replicated commit log. Producers publish events to topics, brokers store them durably, and consumers read them independently at their own offset.

How does Kafka differ from a traditional message queue? A queue typically deletes a message once it is consumed by one subscriber. Kafka retains events on a log for a configured period, lets many independent consumers read the same stream, and supports replay by resetting offsets.

What is a broker? A single Kafka server. A cluster is a set of brokers that store partitions, replicate them, and handle client requests. One broker acts as the partition leader for each partition.

What is KRaft mode? KRaft replaces ZooKeeper by managing cluster metadata inside Kafka using a Raft-based consensus protocol. It simplifies operations and is the standard from Kafka 3.x onward.

Partitions & Ordering

What is a partition and why does it matter? A partition is an ordered, immutable log that is the unit of parallelism and scale. More partitions allow more consumers in a group to read in parallel.

Does Kafka guarantee global ordering? No. Ordering is guaranteed only within a partition, never across partitions. For global order you would need a single partition, sacrificing scalability.

How do you keep related events ordered? Give them the same key. Kafka hashes the key to a partition (hash(key) % partitions), so all events with that key land in one partition and stay ordered.

What happens if you increase a topic’s partition count? New partitions are added, but the key-to-partition mapping changes for future writes because the modulo changes. Existing data is not redistributed, which can break per-key ordering guarantees.

What is an offset? A monotonically increasing integer identifying an event’s position within a partition. Consumers commit offsets to track progress and to resume after restarts.

Delivery Semantics

Explain the acks setting. acks=0 does not wait (fastest, lossy), acks=1 waits for the leader write, and acks=all waits for all in-sync replicas (most durable).

What are the three delivery semantics? At-most-once (may lose, never duplicate), at-least-once (never lose, may duplicate), and exactly-once (no loss, no duplicates). At-least-once is the practical default.

How does Kafka achieve exactly-once? With an idempotent producer (deduplicates retries) plus transactions (transactional.id) for atomic read-process-write, so consuming, processing, and producing commit together.

What is the ISR set? The in-sync replicas — the replicas fully caught up with the leader. With acks=all and min.insync.replicas, a write is only acknowledged once enough ISR members have it.

Consumer Groups

What is a consumer group? A set of consumers sharing a group.id. Kafka assigns each partition to exactly one consumer in the group, enabling parallel, coordinated consumption.

What happens if there are more consumers than partitions? The extra consumers sit idle, because a partition can be assigned to only one consumer within a group at a time.

What is a rebalance? The process of reassigning partitions across group members when a consumer joins, leaves, or fails. Frequent rebalances hurt throughput, so timeouts and static membership are tuned to minimize them.

Why prefer manual offset commits? Auto-commit can advance the offset before your handler finishes, so a crash silently skips records. Manual commits after successful processing give at-least-once safety.

Operations

How do you achieve durability in production? Replication factor 3 with min.insync.replicas=2 and acks=all. This tolerates one broker failure while still durably acknowledging writes.

How is data retention controlled? Via retention.ms (time) and retention.bytes (size) per topic, or log compaction (cleanup.policy=compact) which keeps the latest value per key indefinitely.

Interview tip: when asked about guarantees, always state your assumptions about acks, replication, and offset-commit timing. Kafka’s behavior is a product of all three, and naming them signals real operational understanding.

Last updated June 1, 2026
Was this helpful?