How many times kafka stream invokes poll() for fet

2020-03-30 03:17发布

问题:

I am trying to understand kafka stream processor a bit more. I want to know what is the frequency of polling by a kafka stream processor for fetching the data from kafka.

As I understand kafka stream processor internally creates a kafka Consumer client which fetches the data from kafka (and it invokes poll()).

So when first time poll() is called, what is the next time it would be called again to fetch data from kafka? Does it happen many times per second ? How can I know how many times poll() has been called (for fetching data from kafka).

Any help in understanding this would be of great help.

回答1:

There is no absolute number on how often poll() is called. There are multiple factors that impact how often poll() is called. As a simplified model, you can assume that poll() is called, fetches N records, and is called again after all N records are processed.

Kafka Streams collects metrics that tell you how often poll() is called though, so you can easily monitor it: https://docs.confluent.io/current/streams/monitoring.html