Я использую kafka-console-consumer
для исследования темы кафки.
Время от времени я получаю это сообщение об ошибке, за которым следуют 2 предупреждения:
[2018-05-01 18:14:38,888] ERROR [Consumer clientId=consumer-1, groupId=console-consumer-56648] Offset commit failed on partition my-topic-0 at offset 444: The coordinator is not aware of this member. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)
[2018-05-01 18:14:38,888] WARN [Consumer clientId=consumer-1, groupId=console-consumer-56648] Asynchronous auto-commit of offsets {my-topic-0=OffsetAndMetadata{offset=444, metadata=''}} failed: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that 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 message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)
[2018-05-01 18:14:38,888] WARN [Consumer clientId=consumer-1, groupId=console-consumer-56648] Synchronous auto-commit of offsets {my-topic-0=OffsetAndMetadata{offset=447, metadata=''}} failed: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that 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 message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)
В журналах предупреждений указано, что:
This means that 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 message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.
Итак, мне нужно либо увеличить max.poll.interval.ms
, либо уменьшить max.poll.records
.
Посоветуйте, пожалуйста, каковы будут последствия каждого метода и какой из них предпочтительнее в разных ситуациях?
Если вы увеличите max.poll.interval.ms
, в котором говорится: «Можно тратить время на обработку большого пакета записей», и вы увеличите пропускную способность, если сможете обрабатывать большие пакеты более эффективно, чем более мелкие.
Для уменьшения max.poll.records
говорит: «Берите меньше записей, чтобы было достаточно времени для их обработки» и предпочитает задержку пропускной способности.
Также учтите, что оба настроены нормально, но что-то еще вызывает проблемы с производительностью в вашем цикле poll
. Я бы сначала изучил это, прежде чем менять конфигурацию, чтобы вы не замаскировали более серьезную проблему.
Как мы можем узнать, что вызывает проблемы с производительностью в цикле опроса?
Проверьте что-то очевидное, например блокировку сетевого вызова медленной службы, в противном случае перейдите к любым инструментам, которые вы обычно используете для диагностики производительности.
Не могли бы вы подробно описать, как вы исправили свое дело?