What is negative effects of setting max.poll.interval.ms larger than request.timeout.ms in Kafka consumer configs

孤街浪徒 提交于 2020-05-30 06:25:42

问题


According to Kafka documentation;

The new Java Consumer now supports heartbeating from a background thread. There is a new configuration max.poll.interval.ms which controls the maximum time between poll invocations before the consumer will proactively leave the group (5 minutes by default). The value of the configuration request.timeout.ms must always be larger than max.poll.interval.ms because this is the maximum time that a JoinGroup request can block on the server while the consumer is rebalancing, so we have changed its default value to just above 5 minutes.

But I couldn't understand the possible results of making max.poll.interval.ms larger than request.timeout.ms.

Can anybody explain this part of document:

because this is the maximum time that a JoinGroup request can block on the server while the consumer is rebalancing

Now I'am using these consumer parameters in my project:

kafka.consumer.session.timeout.ms=30000
kafka.consumer.heartbeat.interval.ms=10000
kafka.consumer.request.timeout.ms=31000
kafka.consumer.max.poll.interval.ms=259200000
kafka.consumer.max.partition.fetch.bytes=10242880

What would be the negative effects of these usage?

Note: My kafka-clients version is 1.1.0

UPDATE

From Kafka version 2.0.0 this rule is not valid anymore. From Kafka docs Notable changes in 2.0.0:

Also as part of KIP-266, the default value of request.timeout.ms has been changed to 30 seconds. The previous value was a little higher than 5 minutes to account for maximum time that a rebalance would take. Now we treat the JoinGroup request in the rebalance as a special case and use a value derived from max.poll.interval.ms for the request timeout. All other request types use the timeout defined by request.timeout.ms


回答1:


request.timeout.ms specifies how long the consumer will wait for a response from the broker.

max.poll.interval.ms is used in a couple of use cases. It first specifies how often the consumer was to intereact with brokers (to confirm it's alive) but it's also used when the consumer joins a group. In this case, it indicates how long the broker can take to respond to the join group request.

So if max.poll.interval.ms is larger than request.timeout.ms, you see that the broker may take longer to respond than the consumer will wait. So the consumer could timeout requests.

In many cases, the defaults values for these 2 configurations are relatively good. Instead of overriding them to the large values I see in your question, you should first start by clearly identify how you want to change the default behaviour.



来源:https://stackoverflow.com/questions/54822434/what-is-negative-effects-of-setting-max-poll-interval-ms-larger-than-request-tim

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!