PrepPilotPractise free

Streaming & Kafka interview questions

Kafka, partitions, consumer groups, delivery semantics

18 questions · topic · updated November 2026

Practise these as flashcards. One or two lines each; the ones you miss come back first.

Start free

Core questions

What is a Kafka topic and how is data organized within it?

A Kafka topic is a logical channel to which records are published. Data in a topic is split into partitions, and each partition is an ordered, immutable sequence of records identified by offsets.

How does a producer decide which partition to send a message to?

If a key is provided with the message, Kafka uses a hash of the key to determine the partition, ensuring ordering for that key. If no key is provided, messages are distributed round-robin across partitions.

What is the role of a consumer group in Kafka?

A consumer group allows multiple consumers to share the work of reading from a topic. Each partition is consumed by only one consumer in the group at a time, enabling parallelism and scalability.

What is an offset in Kafka?

An offset is a unique identifier for each record within a partition. It tracks a consumer's position and allows resuming consumption from a specific point.

What happens if a Kafka broker that is a partition leader fails?

Kafka automatically elects a new leader from the in-sync replicas for that partition, ensuring continued availability and durability.

Intermediate questions

Explain the difference between at-most-once and at-least-once delivery semantics in Kafka.

At-most-once means a message is delivered zero or one time, so some messages may be lost but never duplicated. At-least-once ensures every message is delivered at least once, so no data is lost, but duplicates may occur if processing fails after offset commit.

How does Kafka achieve fault tolerance for topic data?

Kafka replicates each partition across multiple brokers. One broker is the leader for each partition, and others are followers. If the leader fails, a follower is promoted to leader, ensuring data availability and durability.

What is a watermark in stream processing?

A watermark is a mechanism to track the progress of event time in stream processing. It helps determine when a window can be closed, even if some late events may still arrive.

How does Kafka ensure message ordering?

Kafka guarantees ordering only within a partition. By using a consistent key, all related messages go to the same partition, preserving their order.

What is the purpose of a schema registry in a Kafka ecosystem?

A schema registry manages and enforces schemas for data in Kafka topics, enabling producers and consumers to agree on data structure and supporting schema evolution with compatibility checks.

Describe a scenario where you would choose batch processing over streaming.

I would choose batch processing for use cases like nightly ETL jobs or large-scale analytics where low latency is not required, and it's more efficient to process data in bulk for simplicity and throughput.

How does Kafka handle consumer group rebalancing?

When consumers join or leave a group, Kafka triggers a rebalance to redistribute partitions among the available consumers. This ensures load balancing but can cause temporary unavailability or duplicate processing during the transition.

What is the impact of setting acks=all in a Kafka producer?

See the answer in the app, free

How does Kafka Streams handle stateful operations?

See the answer in the app, free

Senior questions

How would you implement exactly-once semantics in a Kafka-based pipeline?

See the answer in the app, free

What are the trade-offs between increasing the number of partitions for a topic?

See the answer in the app, free

How do you handle schema evolution in a production Kafka pipeline?

See the answer in the app, free

Describe how you would debug a situation where consumers are lagging behind producers.

See the answer in the app, free

More Data Engineering topics