On a professional social network, the notif-enricher consumer group reads a 48-partition engagement-events topic (about 30,000 events a second at peak). For each event it looks up the member's notification preferences through an internal service backed by MySQL, then writes a notification row to Cassandra. Lag started climbing at 10:40. Broker CPU, disk and produce latency are normal, with no under-replicated partitions. The on-call engineer scaled the consumers from 24 to 60 pods, and lag kept growing.
The interviewer asks“Lag on this consumer group has grown to 18 million records and notifications are 40 minutes late. The brokers look healthy and every consumer is busy. Walk me through how you find the bottleneck, what you do right now, and what you change so it doesn't happen again.”
Lag grows when the arrival rate exceeds the group's processing capacity, which is roughly partitions divided by the time per record when each partition is processed sequentially. So I'd measure both. poll-idle-ratio near zero confirms the consumers are processing-bound, and per-stage timings show where the time goes, usually a per-record call to a slower downstream dependency. I'd also check the shape of the lag across partitions: uniform means systemic, a single partition means a hot key or a poison message. Mitigation is to stop scaling past the partition count, fix or cache the slow dependency, and skip stale low-value events if the business agrees. Then batch lookups and writes, process in parallel within each partition while keeping per-key order, and alert on lag in seconds and on capacity headroom.
A free account unlocks the rest of it, and saves your progress across every track.
strace Trace the system calls a process makesltrace Trace the library calls a program makeslsof List open files, sockets and the processes holding themdmesg Read the kernel's message logperf Profile where CPU time goes, kernel and user spacegdb Debug crashes, core dumps and hung processescoredumpctl Find and open core dumps captured by systemdsar Collect and replay system activity history