01 / 05

What does the producer acknowledgement setting control?

Difficulty: 2/10
Reliability and performance

acks controls how many brokers must confirm a write before the producer treats it as successful, trading durability against latency

The acks setting defines when the broker's response counts as success for a produce request. With acks=0 the producer does not wait at all: it is fastest, but a lost record is invisible and you never learn the offset. With acks=1 the partition leader acknowledges after writing to its own log. If the leader dies before followers copy the record, that acknowledged record can be lost. With acks=all (or -1) the leader waits until all replicas currently in the in-sync replica set (ISR) have the record. This is the setting that gives real durability, but it adds replication round-trip time to every request.

The part people miss is that acks=all alone is not a guarantee. It means all replicas in the ISR, and the ISR can shrink to just the leader. If min.insync.replicas is 1, acks=all degrades to leader-only durability. The standard durable combination is replication.factor=3, min.insync.replicas=2 and acks=all: a write needs the leader plus at least one follower, and if fewer than two replicas are in sync the producer gets NotEnoughReplicas errors instead of silently accepting risky writes. The cost is availability: with two of three brokers down, writes stop. That is a deliberate trade of availability for consistency.

javascript
  1. 1

    Trade-off: acks=1 is lower latency and reasonable for metrics, logs or clickstream where losing a few records on failover is acceptable. acks=0 fits only fire-and-forget telemetry. I use acks=all for anything that represents business state.

  2. 2

    Common mistake: believing acks=all means all replicas. It means all in-sync replicas, so min.insync.replicas is what sets the floor.

  3. 3

    Common mistake: tuning acks without considering retries. With acks=0 the producer cannot detect failures, so retries do nothing for you.

  4. 4

    Latency note: acks=all latency is driven by the slowest in-sync follower, so one slow broker or disk raises p99 for everyone, and cross-AZ replication adds network time.

  5. 5

    Version note: client defaults changed in Kafka 3.0, where acks=all and idempotence became defaults. Older clients default to acks=1, so state the version and set it explicitly in production code.

Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.