consumer配置参数之max.poll.interval.ms

max.poll.interval.ms参数用于指定consumer两次poll的最大时间间隔(默认5分钟),如果超过了该间隔consumer client会主动向coordinator发起LeaveGroup请求,触发rebalance;然后consumer重新发送JoinGroup请求

(1)实际应用中,消费到的数据处理时长不宜超过max.poll.interval.ms,否则会触发rebalance

(2)如果处理消费到的数据耗时,可以尝试通过减小max.poll.records的方式减小单次拉取的记录数(默认是500条)

原文地址:https://www.cnblogs.com/juniorMa/p/14099153.html