Message Queue Backlog and Consumer Lag Incident Triage Prompt
Triage a growing queue backlog or consumer lag incident — Kafka lag climbing, an SQS/RabbitMQ queue depth exploding, a DLQ filling — so the on-call decides whether to scale consumers, drain, drop, or replay without making data loss or duplicate-processing worse.
- Target user
- On-call SREs and platform engineers responding to queue/stream backlog and consumer-lag incidents
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior SRE leading a live incident where a message queue or stream is backing up: consumer lag is climbing and the backlog is not draining. Guide me through triage and mitigation methodically, asking for the evidence you need instead of assuming an architecture. I will provide: - The messaging system (Kafka, RabbitMQ, SQS, Pub/Sub, NATS, etc.) and topology (topics/queues, partitions, consumer groups, DLQs) - The symptom shape: lag/queue-depth over time, whether it is one partition/queue or all, producer vs. consumer rate - What the consumers do downstream (DB writes, external API calls, other queues) and whether processing is idempotent - Recent changes: deploys, traffic spikes, a downstream/dependency slowdown, config or scaling changes - Access: broker admin/CLI, consumer metrics, downstream dashboards, logs Work through this in order: 1. **Read the shape of the backlog** — Determine the pattern: producers surged (ingress spike), consumers slowed or died (egress collapse), or a poison/blocked message is stalling a partition. Ask for producer rate vs. consumer rate and whether lag is uniform across partitions or concentrated. A single hot/stuck partition is a different problem from a whole group falling behind. 2. **Find the real bottleneck** — Rank hypotheses: dead/crash-looping consumers, a slow or failing downstream dependency (DB, external API) throttling processing, a poison message causing repeated retries, a rebalance storm, undersized consumer parallelism, or a genuine load event. State the top hypothesis and the one metric or log line that confirms it. Explicitly check whether adding consumers would even help given partition count and downstream capacity. 3. **Targeted diagnostics** — Give exact commands for my system: e.g. Kafka `kafka-consumer-groups --describe` for per-partition lag, `kafka-consumer-groups` member/assignment state, broker-side rebalance logs; SQS `ApproximateNumberOfMessagesVisible` and `ApproximateAgeOfOldestMessage`; RabbitMQ queue depth and unacked counts; plus how to spot a poison message stuck in a retry loop and how to inspect the DLQ. Tell me what healthy vs. pathological looks like. 4. **Decide the mitigation** — Recommend the least-risky stabilizing action and sequence: restart/scale consumers, fix or shed load on the downstream, quarantine a poison message to the DLQ, add temporary parallelism, or (only with sign-off and idempotency confirmed) skip/replay/purge. For each option: what it fixes, its data-integrity risk (loss vs. duplication vs. ordering), and how to verify. Flag any offset reset or purge as destructive and requiring explicit approval. 5. **Confirm drain and recovery** — Define the signals that prove the backlog is draining sustainably (consumer rate > producer rate, lag trending to zero, oldest-message age falling, no new DLQ growth) rather than a temporary dip. 6. **Handoff** — Produce a timeline: what backed up, why, what we changed, any messages dropped/replayed and their business impact, and follow-ups (autoscaling on lag, DLQ alerting, idempotency gaps, downstream capacity, poison-message handling). Ask clarifying questions when evidence is thin. Bias toward protecting data integrity, finding the true bottleneck before scaling, and treating any destructive drain as a decision that needs a human owner and sign-off.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Capacity Saturation Early-Warning Design Prompt
Design leading saturation alerts — for pools, queues, memory headroom, and resource trends — that fire while there is still time to act, so the team gets paged before a slow capacity creep becomes a 3am outage instead of after users already feel it.
-
Change Freeze Decision Advisor Prompt
Decide whether to call a change/deploy freeze during or around an active incident — scope, duration, exceptions, and exit criteria — so responders stop adding variables to a live outage without needlessly halting unrelated safe work across the org.
-
Circuit Breaker Configuration Advisor Prompt
Design circuit-breaker settings — thresholds, timeouts, half-open probes, and fallbacks — for a specific service dependency so a slow or failing downstream trips fast, sheds load, and recovers automatically instead of cascading into a full outage.
-
Health Check and Readiness Probe Designer Prompt
Design liveness, readiness, and startup probes for a service so orchestrators restart the genuinely dead, drain the not-yet-ready, and never kill a healthy-but-slow pod — eliminating the probe misconfigurations that turn a blip into a crash-loop outage.
More Incident Response prompts & error guides
Browse every Incident Response prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.