Blog

Kafka Consumer Lag: Find the Partition Falling Behind

Diagnose Kafka consumer lag by partition. Tell a missing consumer from a rebalance or a slow worker, and verify that the backlog is shrinking.

WatchLog Kafka product example showing the audit consumer group with no members and a growing backlog.

Kafka is accepting writes, but new orders are slow to reach the fulfillment worker. Before adding consumers, find out where the gap is growing: which group, which topic, and which partition. A group that lost its consumers needs a different fix from a healthy group processing a burst of work.

Start with the partition, not the group total

For a given group and partition, offset lag is the difference between the log end offset and the group’s committed offset. Take two readings a few minutes apart. If the end advances by 4,000 but the commit advances by 1,000, the lag grew by 3,000. If the commit advances faster than the end, the consumer is catching up. A flat commit alone doesn’t distinguish a stalled worker from a worker that processes in batches and commits infrequently.

The group total can hide a single hot partition. Use WatchLog’s Kafka view to narrow the investigation to a group and topic, then confirm offsets and assignments per partition. The cover is a WatchLog product example of the audit group losing its last member, not an incident report.

bin/kafka-consumer-groups.sh --bootstrap-server broker.example:9092 --describe --group fulfillment

Use your actual broker, group and client configuration. The Apache Kafka operations guide shows the offset and member columns; repeat the command with --members --verbose to inspect assignments and --state to inspect group state. These checks do not reset offsets.

Check members and partition availability before scaling

  • No active members: Confirm the group is supposed to be running. Compare when its last member left against worker exits, replicas and rollout events. A reconnecting worker can take time to catch up even after it rejoins.
  • Repeated rebalances: Sample more than once. A rebalance during a planned deploy can be normal; recurring membership churn and stalled commits after the deploy warrant checking restarts, poll intervals and long-running work.
  • Stable members, rising lag: Check whether the lagging partition has a leader, then inspect its assigned consumer. Is it waiting on database writes or retries? Is one partition receiving most of the records? Adding consumers does not split a single partition among multiple members of the same group.

Treat “time behind” as an estimate

WatchLog compares current commits with historical topic end offsets. It does not read message bodies or use a record’s own timestamp. A partition that has never committed can make the topic estimate look longer. Use offset movement to locate the backlog and an application timestamp if you need to verify how long work actually took to reach users.

Verify recovery in the same partition

Check that membership stays stable, the affected commit moves, and the gap shrinks while producers are still writing. Then verify that the work downstream, such as completed fulfillment, is arriving again.

Connect Kafka to WatchLog to read broker, partition and consumer-group metadata without reading message bodies. To see the rest of WatchLog without installing anything, open the live demo.

See your own servers in five minutes.

Free on WatchLog Cloud for 5 servers or nodes, or run it yourself, open source.