Interview Prep/Real-World Interview/Scaling and performance

An SQS queue backlog is growing and messages are hours old. What do you do?

IntermediateScenarioScaling and performance
Answer

Situation read → Consumers are slower than producers. Either consumers are failing, too few, or something they depend on is slow.

What I'd do →

  1. Check queue metrics: ApproximateNumberOfMessagesVisible, ApproximateAgeOfOldestMessage, and whether messages go to the DLQ.
  2. Check consumers: are they running, erroring, or stuck on poison messages that keep returning after the visibility timeout?
  3. Scale consumers on queue depth with KEDA:
triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.ap-south-1.amazonaws.com/123456789012/orders
      queueLength: "100"
      awsRegion: ap-south-1
  1. Make sure the downstream (DB, API) can take the extra throughput; scaling consumers can overload it.
  2. Set a maxReceiveCount redrive policy so poison messages go to a DLQ instead of blocking.

Why → Scaling on queue depth matches capacity to work; scaling on CPU doesn't.

Interview tip → Mention poison messages and visibility timeout; they cause backlogs with no capacity issue at all.

All Real-World Interview questions Roadmap: Interview readiness

More on Scaling and performance