CodePark/ questions / Kafka: producers, acks & durability
START PRACTICINGPRACTICE
Backend question · Message queues & streaming › Kafka: producers, acks & durability

What do the producer settings acks=0, acks=1 and acks=all mean, and what does each risk?

acks controls when the broker (the Kafka server) confirms a write to the producer.

acks=0: the producer does not wait for any response. This is the fastest option. But the producer never learns about failures, so messages can be lost silently.

acks=1: the partition leader confirms once it has written the record to its own log. Risk: the leader may fail before the followers copy the record. Then a follower becomes the new leader without that record. The record is lost, even though the producer got a confirmation.

acks=all (or -1): the leader confirms only after all in-sync replicas have the record. In-sync replicas (the ISR) are the copies that are up to date with the leader. This is the durable choice. It is the default in Kafka 3.0+ clients.

Its guarantee depends on min.insync.replicas. Why? If the ISR shrinks to just the leader, "all" means only one copy.

  • acks=0 waits for no confirmation, so messages can be lost silently.
  • acks=1 waits for the leader only, so a record is lost if the leader dies before followers copy it.
  • acks=all waits for all in-sync replicas, and it is the default since Kafka 3.0.
  • How safe acks=all is depends on min.insync.replicas.