Scrivio Interview library
ScenarioAdvanced7 min read · updated 12 November 2026

Your company's event platform has 300 consumer groups. Teams get paged for lag that resolves itself, and real lag problems are missed. How would you define a standard lag alerting policy?

Try it yourself

Consumer group: who reads which partition

Change the number of partitions and consumers, and see who owns what, who is idle, and where ordering holds.

Read this example as text

Who reads which partition

  1. 3 partitions, 2 consumers. C0 reads P0, P1; C1 reads P2.
  2. 4 partitions, 2 consumers. C0 reads P0, P1; C1 reads P2, P3.
  3. 3 partitions, 3 consumers. C0 reads P0; C1 reads P1; C2 reads P2.
  4. 6 partitions, 4 consumers. C0 reads P0, P1; C1 reads P2, P3; C2 reads P4; C3 reads P5.
  5. 2 partitions, 4 consumers. C0 reads P0; C1 reads P1; C2 is idle; C3 is idle.

A partition has exactly one reader in the group. A consumer beyond the number of partitions is idle.

Six records with 3 partitions and 2 consumers

  1. Record A1. Key A goes to P0, read by C0.
  2. Record B1. Key B goes to P1, read by C0.
  3. Record A2. Key A goes to P0, read by C0.
  4. Record C1. Key C goes to P2, read by C1.
  5. Record B2. Key B goes to P1, read by C0.
  6. Record A3. Key A goes to P0, read by C0.

A1, A2 and A3 sit in one partition and are read in that order. Nothing orders a record in one partition against a record in another.

What this example leaves out
  • One topic, and Kafka's range assignor, the first in the default list. Other assignors spread partitions differently.
  • A, B and C stand for key hashes 0, 1 and 2. The real client hashes the key bytes; the rule shown, same key to the same partition, is the same.
  • A rebalance is shown as instant. In a real group, consumers stop briefly while partitions move.

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.

Same offset lag, very different meaning
GroupWrite rate10,000 records of lag means
clickstream-enricher50,000 / s0.2 seconds behind
order-processing200 / s50 seconds behind
refunds-ledger10 / min16 hours behind
A single offset threshold is wrong for almost every group.

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.

YAML
# Group metadata, kept with the service's code (example format)
consumer-group: refunds-ledger
owner: payments-team
pager: payments-oncall
freshness-objective:
max-time-lag: 60s
target: 99.5% # of minutes within the limit, over 30 days
notes: refunds must reach the ledger within a minute

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.

YAML
# Prometheus-style rules (sketch)
- alert: ConsumerFreshnessBurn
expr: |
avg_over_time((kafka_consumergroup_time_lag_seconds > on(group) group_left
consumer_freshness_limit_seconds)[1h:1m]) > 0.10
labels: { severity: page }
- alert: ConsumerLagGrowing
expr: deriv(kafka_consumergroup_time_lag_seconds[15m]) > 0
for: 15m
labels: { severity: warn }
Step throughFrom lag signal to page
  1. Time lag per group and partitionfrom a broker-side exporter
  2. Compare with the group's freshness limitdeclared by the owner
  3. Budget burning fast (e.g. 10% of last hour)?
    YesPage the owning teamNoNext check
  4. Lag growing for 15 minutes?
    YesWarn in the team channelNoNext check
  5. 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.

What to say in the interviewAbout 90 seconds aloud

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.
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/