Interview Prep/Monitoring & Observability/Cloud Monitoring, Incidents and Migrations

Orders are processed through SQS. How do you detect that consumers are falling behind?

BeginnerScenarioCloud Monitoring, Incidents and Migrations
Answer

Situation read → Queue depth alone can be misleading during bursts; message age shows real delay.

What I'd do →

  1. Alarm on ApproximateAgeOfOldestMessage (Maximum) above your processing SLO, e.g. 300 s for 10 minutes.
  2. Watch ApproximateNumberOfMessagesVisible for trends and capacity planning.
  3. Alarm on the DLQ: ApproximateNumberOfMessagesVisible > 0.
  4. Scale consumers on queue depth (KEDA aws-sqs-queue scaler or ECS target tracking).
aws cloudwatch put-metric-alarm --alarm-name orders-queue-age \
  --namespace AWS/SQS --metric-name ApproximateAgeOfOldestMessage \
  --dimensions Name=QueueName,Value=orders --statistic Maximum \
  --period 60 --evaluation-periods 10 --threshold 300 \
  --comparison-operator GreaterThanThreshold \
  --alarm-actions arn:aws:sns:eu-west-1:111122223333:oncall

Why → Age expresses customer impact directly: "orders are 5 minutes late".

Interview tip → Mention that a poisoned message can block FIFO queues; DLQ alerts catch it.

All Monitoring & Observability questions

More on Cloud Monitoring, Incidents and Migrations