kafka message reliability

Kafka has three possible delivery guarantees, which are:

  1. At most once messages may be lost, but never repeated
  2. At least one message is never lost, but may be retransmitted
  3. Exactly once Each message will definitely be transmitted once and only once. When the producer sends a message to the broker, the producer may not know whether the broker has received the message due to a network error. Network errors may occur during message delivery, or the broker may return acks to the producer process after receiving the message. So at this time, the producer will resend the message, but it may cause duplication, ensuring At least one. But in the version of Kafka 0.11.0, by giving each producer a unique ID and generating a sequence num in each message, the message can be deduplicated to achieve exactly once on the producer side. This also involves the setting of an acks value: 1. acks=0, which means that the producer will not wait for the response of the broker, so the producer cannot know whether the message is successful, which may lead to data loss, but at the same time, the acks value is 0 will get the maximum system throughput. 2. acks=1, which means that the producer will get an acknowledgment from the broker when the leader partition receives the message, which will have better reliability, because the client will wait to know that the broker has confirmed the receipt of the message. 3.acks=all(-1), the producer will get confirmation from the broker when all the backup partitions receive the message, this setting can get the highest reliability guarantee, but affects the throughput.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325382570&siteId=291194637