Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. Producer acks: 0, 1, and all

Kafka · Producers & Consumers

Producer acks: 0, 1, and all

Mediumkafka-12
acksdurabilityproducerisrmin.insync.replicas

Question

Explain Kafka producer `acks=0`, `acks=1`, and `acks=all`. Trade-offs?

Solution

acks controls how many replicas must confirm a write before the producer considers it successful.

acks=0 (fire and forget)

  • Producer does not wait for a broker response.
  • Highest throughput, lowest durability.
  • Messages can be lost silently (network blip, broker crash).
  • Rarely acceptable for business data.

acks=1 (leader only)

  • Leader writes to its local log and responds.
  • Followers may not have the data yet.
  • If leader crashes before followers catch up, data can be lost.
  • Common compromise for less critical streams.

acks=all (or acks=-1)

  • Leader waits until the record is replicated to the full ISR (all in-sync replicas).
  • Strongest durability among the three.
  • Pair with min.insync.replicas (e.g. 2) so "all" still means a real quorum of copies.
acks=0:  send → (no wait)
acks=1:  send → leader disk → ok
acks=all: send → leader + ISR replicas → ok

Trade-off table

| acks | Latency | Durability | Typical use | |---|---|---|---| | 0 | Lowest | Weakest | metrics / best-effort | | 1 | Medium | Medium | less critical logs | | all | Highest | Strongest | orders, payments, CDC |

Interview tip: Prefer acks=all + min.insync.replicas=2 + RF=3 for important data. Say why, not just the setting name.

PreviousNext