Kafka Interview Questions
140 questions with reference answers. Open a question, write your answer, and the evaluator shows which expected concepts you covered and which you missed — then compare against the reference.
Beginner40 questions
- #1What is Apache Kafka and what problem does it solve?Core Concepts
- #2What is a Kafka topic and how is it different from a traditional queue?Core Concepts
- #3What is a partition in Kafka and why are they important?Core Concepts
- #4What is an offset in Kafka?Core Concepts
- #5What is the role of a Kafka broker?Core Concepts
- #6What is a consumer group?Core Concepts
- #7What is the difference between at-most-once, at-least-once, and exactly-once delivery?Core Concepts
- #8What is the replication factor?Core Concepts
- #9What are acks in Kafka producer configuration?Core Concepts
- #10What is the High Watermark (HWM)?Core Concepts
- #11What is consumer lag?Operations
- #12How do you increase the throughput of a Kafka consumer?Operations
- #13What does auto.offset.reset=earliest vs latest do?Operations
- #14What is enable.auto.commit and why is it dangerous?Operations
- #15What is Kafka's data retention and how is it configured?Core Concepts
- #16What is the difference between Kafka and RabbitMQ?Core Concepts
- #17What is a Kafka producer and how does key-based partitioning work?Core Concepts
- #18How does Kafka guarantee message ordering?Core Concepts
- #19What are Kafka's built-in compression types?Core Concepts
- #20What is a dead letter queue (DLT) in Kafka?Operations
- #21What is the ISR (In-Sync Replicas) set?Core Concepts
- #22What is ZooKeeper's role in traditional Kafka and what replaced it?Core Concepts
- #23What is the default log retention period in Kafka?Core Concepts
- #24How do you view Kafka consumer group lag?Operations
- #25What is min.insync.replicas and when does it matter?Core Concepts
- #26What is a Kafka record/message structure?Core Concepts
- #27What happens when a Kafka broker goes down?Core Concepts
- #28What is log compaction and when would you use it?Core Concepts
- #29What is the difference between kafka-console-producer and kafka-console-consumer?Operations
- #30What serialization formats are commonly used with Kafka?Core Concepts
- #31What is a Kafka broker's bootstrap.servers configuration?Core Concepts
- #32What are Kafka's port conventions?Operations
- #33How does a consumer know which offset to start from?Core Concepts
- #34What is Kafka Streams?Core Concepts
- #35What is Kafka Connect?Core Concepts
- #36What is the difference between Kafka's @KafkaListener and manual polling?Core Concepts
- #37What is Schema Registry?Core Concepts
- #38What is the purpose of the __consumer_offsets topic?Core Concepts
- #39What is the kafka-topics.sh tool used for?Operations
- #40Why can't you have more consumers in a group than partitions?Core Concepts
Intermediate30 questions
- #41Explain the producer request lifecycle with acks=all in detail.Internals
- #42What is the difference between LEO and HWM? Why does it matter for consumers?Internals
- #43How does Kafka handle leader election when a broker fails?Internals
- #44How would you tune a Kafka producer for maximum throughput?Performance
- #45What causes consumer rebalancing and how can you minimize it?Performance
- #46What is the difference between Kafka's request queue and the Purgatory?Internals
- #47How do you safely perform a rolling upgrade of a Kafka cluster?Operations
- #48What is the significance of max.in.flight.requests.per.connection in relation to ordering?Internals
- #49Explain the Kafka controller's responsibilities in KRaft mode.Internals
- #50What is the OS page cache and why does it matter for Kafka performance?Performance
- #51How does Kafka use sendfile() for zero-copy transfer?Internals
- #52What is partition reassignment and when do you need it?Operations
- #53What is the difference between sticky and cooperative sticky partition assignment?Internals
- #54How do you prevent consumer lag from growing under high load?Performance
- #55What is Kafka's log segment and why does it matter?Internals
- #56How would you debug a 'LEADER_NOT_AVAILABLE' error in production?Operations
- #57What is unclean leader election and why is it dangerous?Internals
- #58What is the significance of num.partitions for a topic?Performance
- #59How do you reset consumer offsets to reprocess messages?Operations
- #60What is Kafka's inter-broker replication protocol?Internals
- #61How does Kafka guarantee message ordering with multiple producers?Operations
- #62What is the impact of increasing Kafka's JVM heap size?Performance
- #63What is Kafka's wire protocol and how does versioning work?Internals
- #64What are the main JMX metrics to monitor for a healthy Kafka cluster?Operations
- #65How does a Kafka producer handle a NOT_LEADER_OR_FOLLOWER error?Internals
- #66How does Kafka achieve low latency with acks=all?Performance
- #67What is rack awareness in Kafka and why is it important?Operations
- #68What is Kafka's RecordAccumulator and how does it buffer messages?Internals
- #69How do you handle message schema evolution in Kafka?Operations
- #70What is the difference between Kafka's Fetch API and consumer.poll()?Internals
Advanced20 questions
- #71Explain Kafka's exactly-once semantics implementation end-to-end.Internals Deep Dive
- #72What is the Kafka Raft (KRaft) consensus algorithm and how does it differ from ZooKeeper's ZAB?Internals Deep Dive
- #73How does Kafka handle log truncation during replica recovery?Internals Deep Dive
- #74What is the epoch fencing mechanism in Kafka transactions?Internals Deep Dive
- #75How does Kafka's TimingWheel work and why is it used in Purgatory?Internals Deep Dive
- #76Explain the Kafka consumer's heartbeat threading model and how it relates to max.poll.interval.ms.Internals Deep Dive
- #77What is Kafka's sparse index format and how does binary search work on it?Internals Deep Dive
- #78How would you diagnose and fix high producer latency (P99 > 500ms)?Performance
- #79What is the Outbox Pattern and how does Kafka enable it?Architecture
- #80How would you implement the Saga pattern using Kafka?Architecture
- #81Explain event sourcing with Kafka. What are the trade-offs?Architecture
- #82What is the __transaction_state topic and how does it work?Internals Deep Dive
- #83How would you handle a Kafka cluster with millions of partitions?Performance
- #84What is the Kafka Mirror Maker 2 (MM2) and how does multi-cluster replication work?Operations
- #85Explain the Kafka consumer group coordinator and rebalance protocol in detail.Internals Deep Dive
- #86How does Kafka handle backpressure from slow consumers?Performance
- #87What is CQRS with Kafka and how is it different from event sourcing?Architecture
- #88How does Kafka's compaction work internally? What is the cleaner thread?Internals Deep Dive
- #89What is the effect of fsync on Kafka performance and when should you configure it?Performance
- #90How would you design a Kafka-based event-driven microservices architecture?Architecture
Spring30 questions
- #101How do you configure a Kafka consumer in Spring Boot?Spring Kafka Basics
- #102How do you produce messages with KafkaTemplate?Spring Kafka Basics
- #103How do you configure retry and dead letter topics in Spring Kafka?Spring Kafka Error Handling
- #104How do you configure Kafka transactions in Spring Kafka?Spring Kafka Configuration
- #105How do you set up manual offset commits in Spring Kafka?Spring Kafka Configuration
- #106What is the difference between concurrency and partitions in Spring Kafka's listener container?Spring Kafka Configuration
- #107How do you handle deserialization errors in Spring Kafka?Spring Kafka Error Handling
- #108How do you implement a batch @KafkaListener in Spring Kafka?Spring Kafka Advanced
- #109What is spring.kafka.consumer.isolation-level and when do you need it?Spring Kafka Configuration
- #110How do you test Kafka listeners in Spring Boot?Spring Kafka Testing
- #111How do you configure Spring Kafka for JSON serialization with type information?Spring Kafka Advanced
- #112What is SeekToCurrentErrorHandler (now DefaultErrorHandler) in Spring Kafka?Spring Kafka Advanced
- #113How do you configure multiple @KafkaListener annotations for the same topic with different group IDs?Spring Kafka Configuration
- #114What is spring.kafka.listener.missing-topics-fatal?Spring Kafka Advanced
- #115How does @KafkaListener handle partition assignment and offset control?Spring Kafka Advanced
- #116What is the KafkaAdmin bean and how do you use it to manage topics?Spring Kafka Advanced
- #117How do you write a Spring Kafka integration test without external Kafka?Spring Kafka Testing
- #118How do you configure the consumer to start from the beginning for a new application deployment?Spring Kafka Configuration
- #119What is spring.kafka.listener.ack-mode RECORD vs BATCH vs MANUAL?Spring Kafka Advanced
- #120How does Spring Kafka's @RetryableTopic differ from Spring Retry's @Retryable?Spring Kafka Error Handling
- #121How do you implement request-reply pattern with Spring Kafka?Spring Kafka Advanced
- #122What is the difference between ProducerFactory and KafkaTemplate in Spring Kafka?Spring Kafka Configuration
- #123How do you use Kafka headers in Spring Kafka?Spring Kafka Advanced
- #124How do you configure consumer listener concurrency for optimal throughput?Spring Kafka Advanced
- #125What happens if a @KafkaListener throws an uncaught exception?Spring Kafka Configuration
- #126How do you configure Spring Kafka consumer groups for multi-tenancy?Spring Kafka Advanced
- #127What is the difference between DefaultErrorHandler and CommonErrorHandler in Spring Kafka?Spring Kafka Error Handling
- #128How do you configure Spring Kafka for Avro with Confluent Schema Registry?Spring Kafka Configuration
- #129What is spring.kafka.streams and how do you use Kafka Streams in Spring Boot?Spring Kafka Advanced
- #130How do you control the number of messages processed per @KafkaListener invocation?Spring Kafka Configuration
Scenario20 questions
- #141Your Kafka cluster shows UnderReplicatedPartitions > 0. Walk through your debugging steps.Production Scenarios
- #142A consumer group suddenly shows 100,000 messages of consumer lag. How do you respond?Production Scenarios
- #143You're seeing duplicate messages in your consumer application. How do you identify the source and fix it?Production Scenarios
- #144How do you safely add a new topic and deploy a new consumer without downtime?Production Scenarios
- #145A production broker runs out of disk space. What happens and how do you recover?Production Scenarios
- #146Your Spring Boot Kafka consumer stops consuming after processing a malformed message. How do you fix it?Production Scenarios
- #147How do you migrate a Kafka topic to a new cluster with zero data loss?Production Scenarios
- #148Design a Kafka topic schema for an e-commerce order processing system.Production Scenarios
- #149A Kafka Streams application is falling behind. How do you scale it?Production Scenarios
- #150How do you implement exactly-once delivery in a Kafka-to-database pipeline?Production Scenarios
- #151What would you check first if consumers are reading the same messages multiple times after a deployment?Production Scenarios
- #152Design a high-throughput event ingestion pipeline with Kafka.Production Scenarios
- #153A Kafka producer is experiencing high p99 latency. List 5 potential causes and fixes.Production Scenarios
- #154How would you implement an audit log system using Kafka?Production Scenarios
- #155Explain how you'd handle a multi-region Kafka deployment for disaster recovery.Production Scenarios
- #156How do you handle schema evolution when you have 50 consumers reading a Kafka topic?Production Scenarios
- #157What's your strategy for monitoring Kafka in production with 100+ topics?Production Scenarios
- #158How do you safely increase the partition count of an existing Kafka topic?Production Scenarios
- #159What is the maximum number of consumer groups that can read the same Kafka topic simultaneously?Production Scenarios
- #160How would you debug a 'Network Exception: Disconnected' error in a Kafka producer?Production Scenarios