Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if i set value of commit.interval.ms = in kafka stream, Whether it will be able to commit offset?

I am trying to understand behavior of kafka streams related to offset commit. Streams commit offset manually as auto commit is set to "false" in Streams. What if I keep commit.interval.ms = 0 , whether streams will work correctly?

like image 580
omi138 Avatar asked Dec 17 '22 21:12

omi138


1 Answers

If you set commit.interval.ms = 0 Kafka Streams will commit "as soon as possible". In the implementation, there is a poll-process-loop that checks if a commit is required. If you set commit.interval.ms = 0 this check will evaluate to true every time and thus commit will happen each time.

When the commit condition is checked is an internal implementation detail and there is no public contract how ofter the condition is checked. Note, it's not recommended to commit too frequently because it put additional load on Kafka Streams client and the brokers because committing is a sync operation and not for free.

From the comment:

We want to check whether we can store commits in external db..so we want to know can we achieve offset commit management solely on db side

Using Streams API, you cannot store offsets in an external DB. Kafka Streams uses Kafka's group management and commit API and you cannot change this.

like image 173
Matthias J. Sax Avatar answered May 10 '23 21:05

Matthias J. Sax