Producer & acks
A producer chooses how far a message must be stored before it counts as a success. acks=0 waits for nothing and is fastest but never learns whether a broker received it; acks=1 counts the leader's write as success, so a leader failure can lose it; acks=all needs the replicas to have stored it too — the safest and the slowest.
01Producer & acks
Concept at a Glanceacks=0 · no confirmation
acks=0 sends the message and moves straight on. It never waits for a response.
Whether the broker received it, whether it hit disk — the producer has no idea. There is no arrow coming back.
If the network drops and the message vanishes, nothing surfaces on the producer side. There isn't even grounds to retry.
acks=1 · leader only
acks=1 waits for the leader broker to confirm that it wrote the message to its own log.
Once the leader responds, the producer counts it as a success and moves to the next message. The acknowledgement comes straight back from the leader.
The catch is that the followers may not have replicated it yet. Replication trails behind.
If the leader dies at this moment, one of the followers becomes the new leader — and that message exists nowhere.
acks=all · replicas too
acks=all counts a write as successful only once the caught-up replicas (the ISR) have stored it too.
The leader writes, and the followers pull that message across. Nothing proceeds until this finishes.
Only after replication completes does the success response reach the producer. That extra round trip is the cost.
Now the leader can die and a follower that holds the message takes over, so nothing is lost.
02 Understand It Simply
For Everyoneacks sets what must finish before a send counts as successful: 0 waits for nothing, 1 waits for the leader's write, and all waits until the in-sync replicas have stored it too.
acks decides when a write is answered as successful.
0 waits for no response at all, so a dropped connection goes unnoticed.
1 confirms only the leader broker's write, so if the leader dies before the followers replicate, that message is gone.
all responds only once the ISR — the caught-up replicas — have stored it, so it survives losing a broker.
Pick based on whether the data can afford to disappear.
- –Separating settings for lossy data (logs
- –metrics) from critical data (payments)
- –and tuning the throughput/latency/durability trade-off
03 Frequently Asked Questions
FAQWhat is Producer & acks?+
A producer chooses how far a message must be stored before it counts as a success. acks=0 waits for nothing and is fastest but never learns whether a broker received it; acks=1 counts the leader's write as success, so a leader failure can lose it; acks=all needs the replicas to have stored it too — the safest and the slowest.
Where is Producer & acks used?+
Separating settings for lossy data (logs, metrics) from critical data (payments), and tuning the throughput/latency/durability trade-off.
What's a simple analogy for Producer & acks?+
acks sets what must finish before a send counts as successful: 0 waits for nothing, 1 waits for the leader's write, and all waits until the in-sync replicas have stored it too.
