Company
Date Published
Author
Evan Nelson
Word count
1299
Language
English
Hacker News points
None

Summary

Kafka's auto-commit mechanism can lead to data loss and duplication if a consumer experiences an out of memory (OOM) kill or other hard shutdown, as it may reprocess messages that were received but not yet committed. This occurs because the consumer has no knowledge of what happens to the message after it is pulled in, and auto-commits can occur at intervals controlled by `auto.commit.interval.ms`, which can lead to hundreds of messages being lost or duplicated. To mitigate this risk, users can consider using streaming solutions like Flink or Kafka Streams that offer exactly-once processing, implementing their own transactional semantics in consumers, or accepting the risk and building reliable services with stable alerts for service shutdowns.