Kafka · Write code
Reading kafka-consumer-groups output
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
Here's kafka-consumer-groups.sh --describe for our notifications group, which runs on 8 pods. Walk me through what you see and what you'd do next.
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
notifications order-events 0 1820450 1820512 62 notif-1-7f9c... /10.2.1.14 notif-1
notifications order-events 1 1798233 1798301 68 notif-2-0b41... /10.2.1.20 notif-2
notifications order-events 2 911204 1803998 892794 notif-3-a21d... /10.2.3.9 notif-3
notifications order-events 3 1802117 1802190 73 notif-4-b8e0... /10.2.4.2 notif-4
notifications order-events 4 1799801 1799870 69 notif-5-c3aa... /10.2.4.7 notif-5
notifications order-events 5 1801001 1801044 43 notif-6-91de... /10.2.5.3 notif-6
Then
Follow-ups the interviewer asks next
- How is LAG worked out?
- Is partition 2 slow or stuck? How do you tell?
- The group has 8 pods but only 6 appear here. Why?
- How do you look at the exact message partition 2 is on?
- Someone wants to move partition 2's offset past that message. What must happen first, and what's the risk?
- What would you alert on?
The answer
What a strong answer covers
- LAG = LOG-END-OFFSET − CURRENT-OFFSET (the group's committed offset). Five partitions are healthy (lag under 100). Partition 2, owned by notif-3, is about 8.9 lakh behind.
- Slow or stuck: run it again a minute later. If CURRENT-OFFSET hasn't moved while LOG-END-OFFSET has, it's stuck: a poison message retried forever, a call with no timeout, or a deadlock. If it moves, but slower than the others, look for key skew or a slow dependency.
- Read the message:
kafka-console-consumer.sh --partition 2 --offset 911204 --max-messages 1(with the right deserializer), plus notif-3's logs and a thread dump. - Only 6 of 8 pods own partitions: 6 partitions means at most 6 active consumers;
--describe --membersshows the other two with 0 partitions. - Moving the offset (
--reset-offsets --to-offset 911205 --execute) only works while the group has no active members, so the consumers must be stopped. It skips the message, so copy it somewhere first (a dead-letter topic) and agree with the business. The real fix is error handling: retry a few times, then dead-letter and move on. - Alert on lag as time (age of the oldest unprocessed message) per partition, on committed offsets that stop moving, and on dead-letter topic growth.
The red pen
Common traps
Avoid:"add more consumers"; resetting offsets while consumers run; reading lag as messages per second.
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.