InterviewSolution
| 1. |
What is meant by Kafka producer Acknowledgement? What are the different types of acknowledgment settings provided by Kafka? |
|
Answer» An ack or ACKNOWLEDGMENT is sent by a broker to the producer to acknowledge receipt of the message. Ack level can be set as a configuration parameter in the Producer and it defines the number of ACKNOWLEDGMENTS the producer requires the leader to have received before considering a request COMPLETE. The following settings are allowed:
In this case, the producer doesn’t wait for any acknowledgment from the broker. No guarantee can be that the broker has received the record.
In this case, the leader writes the record to its local log file and responds back WITHOUT waiting for acknowledgment from all its followers. In this case, the message can get lost only if the leader fails just after acknowledging the record but before the followers have replicated it, then the record would be lost.
In this case, a set leader waits for all entire sets of in sync replicas to acknowledge the record. This ensures that the record does not get lost as long as one replica is alive and provides the strongest possible guarantee. However it also considerably lessens the throughput as a leader must wait for all followers to acknowledge before responding back. acks=1 is usually the preferred way of sending records as it ensures receipt of record by a leader, thereby ensuring high durability and at the same time ensures high throughput as well. For highest throughput set acks=0 and for highest durability set acks=all. |
|