Video in progress
What do the values 0, 1 and all of the producer's acks setting mean?
Speed / Can the message be lost? — 0: fastest / yes, you won't even know if it's lost on the network; 1: medium / yes, if the leader writes it and crashes before the followers get it; all: slower / no (if min.insync.replicas is set correctly)
📖 Answer
| acks | Speed | Can the message be lost? |
|---|---|---|
| 0 | fastest | yes, you won't even know if it's lost on the network |
| 1 | medium | yes, if the leader writes it and crashes before the followers get it |
| all | slower | no (if min.insync.replicas is set correctly) |
The risk with acks=1 is more common than people think: the leader says "written", you're happy, then the leader dies and a follower that hasn't copied the message yet becomes the leader. The message is gone.
Since Kafka 3.0 the producer defaults are acks=all and enable.idempotence=true. In older versions the default was 1, so always check the configuration in old projects.
acks=all alone isn't enough; you also need min.insync.replicas=2 on the broker side. Otherwise, if only one replica is left in the ISR, "all" still means just one copy.
Sign up to mark studied questions and save your progress.