Apache Kafka

1 min read index source

Apache Kafka

Apache Kafka is a distributed streaming platform for building real-time data pipelines and streaming applications.

Key Concepts

Core Components

  • Producer: Applications that publish messages to topics
  • Consumer: Applications that read messages from topics
  • Topic: Category or feed name to which messages are published
  • Partition: Topics are divided into partitions for parallelism
  • Broker: Kafka server that stores topic data
  • Cluster: Group of brokers working together
  • Zookeeper: Coordinates the cluster (being phased out in newer versions)

Architecture

  • Distributed: Runs as a cluster of servers
  • Fault-tolerant: Replicates data across multiple brokers
  • Scalable: Can handle millions of messages per second
  • Real-time: Processes streams of records

Common Interview Questions

  1. What is the difference between Kafka and traditional message queues?
  2. Explain the concept of partitions and their importance
  3. How does Kafka ensure message ordering?
  4. What is consumer group and how does it work?
  5. Explain the role of Zookeeper in Kafka
  6. How does Kafka handle data retention?
  7. What are the different delivery semantics?
  8. How to implement exactly-once processing?
  9. Explain Kafka Streams vs Kafka Connect
  10. How does Kafka handle backpressure?
  11. What are the different producer configurations?
  12. How to implement idempotent producers?