Quick revision
The short answer
I would replace raw offset thresholds with alerts on time lag measured against a freshness objective that each consumer group declares, and use burn-rate or trend-based rules so short spikes during deploys or batch loads do not page anyone. Every group must declare an owner and its objective, a shared dashboard shows lag per partition, rebalance count and processing rate, and noisy alerts are reviewed regularly so the objectives stay tied to what the business actually needs.
What to remember
In this answer, we designed a lag alerting policy for 300 consumer groups. We moved from raw offset thresholds to time lag measured against a freshness objective each group declares, used burn-rate and trend-based rules so short spikes do not page, required every group to declare an owner and objective, provided a shared dashboard with lag per partition, rebalance count and processing rate, and set up regular reviews of noisy alerts so the objectives stay tied to business needs.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would replace raw offset thresholds with alerts on time lag measured against a freshness objective that each consumer group declares, and use burn-rate or trend-based rules so short spikes during deploys or batch loads do not page anyone. Every group must declare an owner and its objective, a shared dashboard shows lag per partition, rebalance count and processing rate, and noisy alerts are reviewed regularly so the objectives stay tied to what the business actually needs.
Why this question is asked
With 300 consumer groups, lag alerting either works as a system or becomes background noise. When teams are paged for lag that clears itself, they learn to ignore the pages, and then the real incident, a stuck consumer behind a payment flow, gets missed. Interviewers ask this scenario because it is a classic monitoring design problem: choosing the right signal, the right threshold and the right ownership at scale. In this answer, we will see why offset-based alerts fail, define freshness objectives on time lag, design alert rules that ignore spikes, assign ownership, build the shared dashboard, and set up the review loop.
1Why Offset Thresholds Page for the Wrong Things
Most lag alerts start as 'page when lag is above 10,000 records'. That number means very different things across 300 groups. For a clickstream group processing 50,000 records a second, 10,000 records is a fifth of a second, and a deploy that pauses consumers for a minute crosses it every time, then recovers. For a low-volume refunds group that receives 10 records a minute, a completely stuck consumer takes 16 hours to reach 10,000.
So the same threshold creates false pages on busy groups and silence on quiet ones. The fix is not tuning 300 numbers by hand, but measuring something that means the same everywhere.
| Group | Write rate | 10,000 records of lag means |
|---|---|---|
| clickstream-enricher | 50,000 / s | 0.2 seconds behind |
| order-processing | 200 / s | 50 seconds behind |
| refunds-ledger | 10 / min | 16 hours behind |
2Measure Time Lag Against a Freshness Objective
Time lag is how old the oldest unprocessed record is, or equivalently how far behind real time the group is. Lag exporters can estimate it from the committed offsets and the timestamps or write rate of each partition, and some consumers can report it directly from record timestamps. Time lag means the same thing for every group: 'we are three minutes behind'.
Each group then declares a freshness objective, a service level objective for staleness, based on what its users need. The fraud scorer might need 99 percent of minutes with time lag under 10 seconds; the order emails, under 2 minutes; the nightly analytics loader, under 6 hours. The objective is the threshold, and it is chosen by the business need, not by guessing a record count.
3Alert Rules That Ignore Spikes
With objectives in place, we alert the way good service level alerting does. A burn-rate alert pages when the group is using up its allowed 'time over the limit' much faster than the objective allows, for example when more than 10 percent of the last hour was over the limit, which would exhaust a monthly budget in days. A short spike during a deploy uses up a little of the budget and pages nobody; a sustained problem pages quickly.
A trend rule complements it for slower failures: warn when time lag has grown continuously for 15 minutes on any partition, which catches a stuck partition long before it breaches the objective on a quiet topic. Expected events, such as a nightly batch load into a group with a 6-hour objective, simply fit within its budget. Finally, an absence alert fires when a group has no active members, because then consumer-side metrics stop and only broker-side lag shows the problem.
- Time lag per group and partitionfrom a broker-side exporter
- Compare with the group's freshness limitdeclared by the owner
- Budget burning fast (e.g. 10% of last hour)?YesPage the owning teamNoNext check
- Lag growing for 15 minutes?YesWarn in the team channelNoNext check
- Group has no active members?YesPage the owning teamNoNo alert
5 steps in order. Play them, or step through them one at a time.
The metric names depend on the exporter we use, so check your tooling; the shape of the rules is what matters.
4Every Group Declares an Owner and an Objective
An alert without an owner goes to a shared channel where nobody acts on it. So the policy requires every consumer group to declare an owning team, an on-call route and its freshness objective, kept in a metadata file in the service's repository or in the platform's catalogue. The alerting configuration is generated from those declarations, so adding a new group with its metadata automatically gives it correct alerts.
For the 300 existing groups, we start by listing them with their recent activity. Groups with no members for months are candidates for deletion. For active ones, we contact owners, starting with the busiest and most business-critical, and give them a default objective, such as 5 minutes, that they can tighten or relax. A group without a declared owner after the deadline is reported to engineering leadership.
5A Shared Dashboard for Diagnosis
When a page arrives, the on-call engineer needs to see quickly whether the problem is one partition or all of them, whether the group is processing at all, and whether it is rebalancing. So the platform provides one standard dashboard per group: time lag and offset lag per partition, records processed per second, processing time per record from the listener timers, number of active members, and rebalance count.
Because the dashboard is the same for all 300 groups, engineers from any team can read it, and the alert links straight to the right group's view. The common patterns become easy to recognise: one partition rising means a hot key or a stuck record; all partitions rising with steady processing time means more input than capacity; processing rate falling to zero means a crash or a downstream outage.
6Review the Noise Regularly
Policies drift. Objectives that were set as defaults may be too strict or too loose, and new failure modes appear. So we review alert quality on a schedule, for example monthly: which alerts fired, which were acted on, and which were noise. Alerts that page without needing action get their objective or rule adjusted; incidents that were found by customers rather than alerts get a new rule.
The review also checks that objectives still match business needs. When the business wants refunds visible within 10 seconds instead of a minute, the objective changes, and the alerting follows automatically. Measuring pages per team per week, and the share that were actionable, shows whether the policy is working.
7Follow-up questions
Why not just alert on offset lag with per-group thresholds?
That can work for a few groups, but at 300 the thresholds are guesses that go stale as traffic changes. Time lag against a declared objective expresses the real requirement directly, and it stays correct when volume doubles.
How do you get time lag if the exporter only knows offsets?
Exporters estimate it by interpolating: they record when each offset was the log end, and look up how long ago the committed offset was written. Alternatively, consumers can report the timestamp of the last record they processed, and time lag is now minus that timestamp, but only while the consumer is running.
Should deploys silence lag alerts?
Not completely. Burn-rate alerts already tolerate short deploy spikes. Silencing during deploys risks hiding a deploy that breaks the consumer, which is exactly when we want to know.
8Conclusion
In this answer, we designed a lag alerting policy for 300 consumer groups. We moved from raw offset thresholds to time lag measured against a freshness objective each group declares, used burn-rate and trend-based rules so short spikes do not page, required every group to declare an owner and objective, provided a shared dashboard with lag per partition, rebalance count and processing rate, and set up regular reviews of noisy alerts so the objectives stay tied to business needs.
Open with
The root problem is that raw offset lag means completely different things across groups. Ten thousand records is a fraction of a second for a clickstream and sixteen hours for a refunds topic, so one threshold pages for noise on busy groups and misses stuck quiet ones.
Then, if they want more
So I'd standardise on time lag, how far behind real time the group is, measured from the broker side so it works even if consumers are down. Each group declares a freshness objective based on what its users need, like ten seconds for fraud scoring or six hours for an analytics loader, and that's the threshold.
Then I'd use burn-rate alerts against that objective, paging only when the group is burning its budget quickly, plus a warning on steadily growing lag and a page when a group has no active members. Deploy spikes and batch loads use a bit of budget and don't page anyone.
Every group must declare an owner, an on-call route and its objective in metadata, and the alert rules are generated from that, so new groups get correct alerts automatically. The platform provides one standard dashboard per group with lag per partition, processing rate, processing time, members and rebalance count, linked from every alert.
And we'd review alert quality monthly, adjusting objectives that are noisy and adding rules for incidents customers found first, so the policy stays tied to business needs.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation, Spring for Apache Kafka reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your company's event platform has 300 consumer groups. Teams get paged for lag that...": https://scrivio-interview-library.netlify.app/spring-boot/kafka/ea4155ffb9/