voipp
voipp

Reputation: 1461

what is the purpose of kafka ack?

kafka consumer saves offsets only when it commits. Thus , when it rise after crash , it can start from previous offset.

But what is the purpose of ack? in case of crash, ack wouldn't help(if they weren't commited)

Upvotes: 1

Views: 12304

Answers (1)

Acks = 0

No response is requested from the broker, so if the broker goes offline or an exception happens, we will not know and will lose data. Useful for data where it's fine to potentially lose messages as metric or log collection.

The best performance is this because the producer will not wait for any confirmation.

Acks = 1 (Default)

Leader response is requested, but replication is not guarantee, this happens in background. If an acknowledgement is not received, the producer could retry without duplicate data. If the leader broker goes offline but replicas haven't replicated the data yet, we have data lost.

Acks = all

The leader and the replicas are requested by acknowledgement, this means that the producer has to wait to receive confirmation of any replica of the broker before to continue, this add latency but ensures safety, this setting ensure no lose data.

Upvotes: 12

Related Questions