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.
01 Concept at a Glance
Interactive Step-by-Stepacks=0 sends the message and moves straight on. It never waits for a response.
acks=1 waits for the leader broker to confirm that it wrote the message to its own log.
acks=all counts a write as successful only once the caught-up replicas (the ISR) have stored it too.
02 Understand It Simply
For EveryoneLike posting a letter. Drop it in the box and walk away (acks=0), take a receipt (acks=1), or wait for confirmation that it arrived (acks=all). More certainty, more waiting.
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?+
Like posting a letter. Drop it in the box and walk away (acks=0), take a receipt (acks=1), or wait for confirmation that it arrived (acks=all). More certainty, more waiting.
