Event Streaming with Kafka
Kafka Producers Consumers The Message Flow
Producer Acknowledgments Acks and Reliability Guarantees
In Apache Kafka, producer acknowledgments—configured via the acks
parameter—determine how producers confirm that messages have been durably written to the cluster. Selecting the right acks
level helps you balance throughput, latency, and data durability in your event-streaming applications.
What Are Acknowledgments (acks)?
When a producer sends a record to a Kafka broker, it can request an acknowledgment from the broker before considering the send successful. Acks define how many brokers must confirm receipt:
- acks=0: No acknowledgment; the producer proceeds immediately.
- acks=1: Leader broker acknowledgment only.
- acks=all (or
acks=-1
): Confirmation from all in-sync replicas (ISRs).
Note
By default, Kafka producers use acks=1
, offering a balance between performance and reliability.
Visual Overview
acks Configuration Options
acks Value | Description | Throughput | Data Guarantee | Typical Use Case |
---|---|---|---|---|
0 | No broker acknowledgment | Highest | Possible message loss if broker crashes | Non-critical logging or metrics streams |
1 | Acknowledgment from leader only | High | Risk of loss if leader fails before replication | Standard event streams |
all / -1 | Acknowledgment from all in-sync replicas (ISRs) | Moderate to Low | Strongest durability as long as ≥1 ISR remains up | Financial transactions, audit logs |
# Example: strong durability
acks=all
Choosing the Right Acks Level
Use the table below to select the appropriate acks
configuration for your Kafka producer:
Objective | Recommended acks | Rationale |
---|---|---|
Maximum throughput | acks=0 | No waits → minimal latency |
Balanced performance | acks=1 | Fast with leader confirmation |
Maximum durability | acks=all | Guarantees replication to all ISRs |
Warning
Using acks=all
increases end-to-end latency. Ensure your cluster’s replication factor and in-sync replica settings are properly configured to avoid unintentional message rejections.
Best Practices
- Always align your
acks
setting with your business requirements for reliability vs. performance. - Monitor ISR health to maintain durability when using
acks=all
. - Combine
acks
with other producer configs likeretries
andmax.in.flight.requests.per.connection
for end-to-end guarantees.
Links and References
- Kafka Producer Configuration
- Apache Kafka Documentation
- Confluent Blog: Understanding Kafka Durability
Watch Video
Watch video content