Visible depth
Messages waiting to be received. It rises with traffic and falls with capacity, so on its own it cannot tell a spike from a stall.
A growing queue is not one problem. A slow consumer, a burst that outruns capacity, a poison message that fails on every attempt, and a retry loop that hammers the database all look identical on a depth chart. The first job is to tell them apart before you add workers or raise a limit.
This page is free. It covers which queue metrics actually move, how visibility timeouts and retry counts turn one bad message into a backlog, and the dead-letter configuration that keeps a failure visible instead of silent.
Messages waiting to be received. It rises with traffic and falls with capacity, so on its own it cannot tell a spike from a stall.
Messages delivered but not yet deleted. If this stays high while visible depth falls, consumers are receiving and failing, not catching up.
The only metric that maps to user-visible latency. A shallow queue with a ten-minute-old message is worse than a deep queue that drains in seconds.
Failures that exhausted their retries. Any sustained value above zero is data loss waiting for a retention window to expire.
| Command or view | What it tells you |
|---|---|
| aws sqs get-queue-attributes --queue-url "$Q" --attribute-names ApproximateNumberOfMessages ApproximateNumberOfMessagesNotVisible ApproximateAgeOfOldestMessage | The three depths and the age, in one call. Values are approximate and can lag by about a minute. |
| aws sqs get-queue-attributes --queue-url "$DLQ" --attribute-names ApproximateNumberOfMessages | Whether failures are accumulating where nobody is looking. |
| npx wrangler queues list and the queue's metrics view | Cloudflare Queues backlog and consumer health for the same window. |
| npx wrangler tail YOUR_WORKER --status error | The actual exception the consumer is throwing, not just the count. |
| Consumer logs: message id, attempt number, handler duration | Whether the same message id repeats (poison) or many ids fail once (dependency down). |
| Database: connection count, lock waits, p99 write latency | Whether the queue is the cause or the symptom of a saturated downstream. |
| # | Failure mode | What you see | What to do |
|---|---|---|---|
| 1 | Visibility timeout shorter than the handler | The same message is delivered twice; logs show two attempts overlapping for one id; duplicate side effects. | Measure p99 handler time and set the timeout above it, then make the handler idempotent on a business key, not just on the message id. |
| 2 | No retry cap | One message returns to the queue forever; depth never reaches zero even with idle consumers. | Set a maximum receive count below the dead-letter threshold and alarm on the DLQ, not on total depth. |
| 3 | A dead-letter queue nobody reads | The DLQ fills silently and its retention window deletes the evidence before anyone investigates. | Alarm on any DLQ message, set retention longer than your response time, and document the redrive command. |
| 4 | Immediate in-process retries | CPU and database connections spike while the queue depth is flat; retries exhaust the dependency instead of waiting. | Retry with exponential backoff and jitter, or return the message to the queue and let the visibility timeout provide the delay. |
| 5 | Scaling consumers to the backlog | Workers double, the downstream saturates, and every consumer starts timing out; the queue grows faster. | Scale on the downstream's healthy capacity, cap concurrency, and use batch size to trade throughput for per-message latency. |
| 6 | FIFO group head-of-line blocking | One tenant's messages stall while other groups drain; the poison message blocks its whole group. | Keep message groups small, cap attempts per group, and move a repeatedly failing message out so the group can advance. |
| 7 | Reading depth as latency | Dashboards look calm while users wait minutes; or a scary spike clears in seconds. | Alert on age of the oldest message and on consumer error rate, and use depth only as context. |
| Decision | Question to answer |
|---|---|
| Idempotency | What business key makes a second delivery harmless: order id, event id, a unique constraint? |
| Attempts | How many receives before the message is parked, and is that number lower than the visibility-timeout math assumes? |
| Backoff | Does a failed attempt wait, or does it return immediately and multiply the load? |
| DLQ | Who is paged, what is retained, and what is the tested redrive path back to the main queue? |
| Isolation | Can one tenant or one message group consume the capacity meant for everyone else? |
Publish a known batch, stop consumers, restart them, and record how long the queue takes to reach zero and what the oldest age does. That is your real throughput, not the vendor's number.
Publish one message the handler always rejects. Confirm it lands in the DLQ after the configured attempts, that the alarm fires, and that the rest of the queue keeps draining.
Move the poisoned message back after a fix and confirm it is consumed once, with no duplicate side effect.
Deliver the same message twice on purpose and confirm the handler's unique constraint or dedupe table absorbs the second delivery.
Only if the downstream has headroom and the message age is falling. If in-flight depth is high and error rate is rising, more consumers multiply the failure. Fix the handler or the dependency first.
That is the visibility timeout cycling: messages are received, the handler fails or is too slow, and they become visible again. Depth looks like progress while nothing is being deleted.
No. It is a holding area with a retention limit and no ordering guarantee. Treat it as evidence plus a redrive source, and alarm on the first message.
No. They reduce duplicates within a deduplication window and preserve order per group, but a handler that times out after doing its work can still be retried. Keep the business-key check.
The paid runbooks cover the surrounding failures: cache rules that hide a deploy, AI gateway timeouts, and platform defaults that only bite on a real domain.
This page is free, no checkout. Paid runbooks are $9.99 each and covered by the 7-day refund policy at /runbooks/refund.