【发布时间】:2022-10-15 03:08:18
【问题描述】:
卡夫卡经纪人版本:2.6.2 Kafka Java Apache 客户端:3.0.0
上周,有多个特定消费者组的所有消费者因错误而死的情况:
consumer poll timeout has expired. This means the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time processing messages. You can address this either by increasing max.poll.interval.ms or by reducing the maximum size of batches returned in poll() with max.poll.records.
我有 200 个分区和 100 个消费者,总摄取率为 800 个事件/秒。每个事件的处理时间大约为 60 毫秒。 max.poll.interval.ms 设置为默认五分钟,max.poll.records=500 也是如此。我已经记录了指标time_between_poll_max,它似乎只有 70-80 年代。所以我知道消费者处理时间少于max.poll.interval.ms。那么还有什么会触发这个错误呢?另外,我注意到poll_idle_ratio_avg 在消费者存活期间为 0,这对我来说没有多大意义。
一般模式是一个消费者收到超时错误,并且该组进入重新平衡状态,这需要很长时间。在此期间,由于轮询超时错误,所有其他消费者都被踢出组。
我在日志中看到了数千条以下消息:
[Consumer clientId==Consumer-2, groupId=EventsConsumer] Request joining group due to: group is already rebalancing
所以我怀疑整个团队死亡的真正原因是这个极其漫长的再平衡阶段。我不确定是什么原因造成的。
【问题讨论】:
标签: apache-kafka kafka-consumer-api