debugMajorpending
Kafka consumer lag growing — consumer can't keep up
Viewed 0 times
consumer lagconsumer grouppartitionsrebalancingmax.poll.recordsstatic membership
linuxdocker
Error Messages
Problem
Kafka consumer lag keeps increasing. Messages are produced faster than they're consumed. The consumer group shows growing lag in kafka-consumer-groups.sh output.
Solution
(1) Scale consumers: add more consumers to the consumer group (max = number of partitions). (2) Increase partitions to allow more parallelism. (3) Optimize consumer processing: batch operations, reduce per-message overhead. (4) Check for slow consumers: one slow partition blocks the whole consumer if using synchronous commits. (5) Tune fetch settings: fetch.min.bytes, fetch.max.wait.ms, max.poll.records. (6) Check for rebalancing storms: frequent consumer joins/leaves cause stop-the-world rebalances. Use static group membership (group.instance.id). (7) Monitor with kafka-consumer-groups.sh --describe --group mygroup. (8) Consider using consumer threads or async processing within each consumer.
Why
Each partition can only be consumed by one consumer in a group. If you have 10 partitions and 3 consumers, you can't parallelize beyond 10. Consumer lag means the processing rate is lower than the production rate.
Revisions (0)
No revisions yet.