Apache Kafka Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. What is Apache Kafka?
Apache Kafka is a publish-subscribe open source message broker application. This messaging application was coded in “Scala”. Basically, this project was started by the Apache software. Kafka’s design pattern is mainly based on the transactional logs design.
Ques 2. Enlist the several components in Kafka.
- Topic: Kafka Topic is the bunch or a collection of messages.
- Producer: In Kafka, Producers issue communications as well as publishes messages to a Kafka topic.
- Consumer: Kafka Consumers subscribes to a topic(s) and also reads and processes messages from the topic(s).
- Brokers: While it comes to manage storage of messages in the topic(s) we use Kafka Brokers.
Ques 3. What is a Consumer Group?
The concept of Consumer Groups is exclusive to Apache Kafka. Basically, every Kafka consumer group consists of one or more consumers that jointly consume a set of subscribed topics.
Ques 4. What is the role of the ZooKeeper in Kafka?
Apache Kafka is a distributed system is built to use Zookeeper. Although, Zookeeper’s main role here is to build coordination between different nodes in a cluster. However, we also use Zookeeper to recover from previously committed offset if any node fails because it works as periodically commit offset.
Ques 5. Is it possible to use Kafka without ZooKeeper?
No. It is impossible to bypass Zookeeper and connect directly to the Kafka server. If somehow, ZooKeeper is down, then it is impossible to service any client request.
Ques 6. What do you know about Partition in Kafka?
In every Kafka broker, there are few partitions available. And, here each partition in Kafka can be either a leader or a replica of a topic.
Ques 7. Why is Kafka technology significant to use?
There are some advantages of Kafka, which makes it significant to use:
- High-throughput: We do not need any large hardware in Kafka, because it is capable of handling high-velocity and high-volume data. Moreover, it can also support message throughput of thousands of messages per second.
- Low Latency: Kafka can easily handle these messages with the very low latency of the range of milliseconds, demanded by most of the new use cases.
- Fault-Tolerant: Kafka is resistant to node/machine failure within a cluster.
- Durability: As Kafka supports messages replication, so, messages are never lost. It is one of the reasons behind durability.
- Scalability: Kafka can be scaled-out, without incurring any downtime on the fly by adding additional nodes.
Ques 8. What are main APIs of Kafka?
- Producer API
- Consumer API
- Streams API
- Connector API
Ques 9. What are consumers or users?
Mainly, Kafka Consumer subscribes to a topic(s), and also reads and processes messages from the topic(s). Moreover, with a consumer group name, Consumers label themselves.
Ques 10. What are the types of traditional method of message transfer?
- Queuing: It is a method in which a pool of consumers may read a message from the server and each message goes to one of them.
- Publish-Subscribe: Whereas in Publish-Subscribe, messages are broadcasted to all consumers.
Ques 11. Describe partitioning key in apache kafka.
Its role is to specify the target divider of the memo within the producer. Usually, a hash-oriented divider concludes the divider ID according to the given factors. Consumers also use tailored partitions.
Most helpful rated by users:
- Explain the concept of Leader and Follower.
- Enlist the several components in Kafka.
- What are main APIs of Kafka?