/Amazon SQS & Message Queuing
Concept Detail

Amazon SQS & Message Queuing

Difficulty: medium

Overview


Amazon SQS is a fully managed message queuing service for decoupling distributed systems.

Queue Types:

FeatureStandardFIFO
ThroughputUnlimited300 TPS (3,000 with batching)
OrderingBest-effortStrict per message group
DeliveryAt-least-onceExactly-once
DeduplicationNoYes (5-min window)

Key Settings:

  • Visibility Timeout: 0s–12 hours (default 30s). Message hidden after receive; must delete before timeout.
  • Message Retention: 1 min – 14 days (default 4 days).
  • Max Message Size: 256 KB.
  • Long Polling: WaitTimeSeconds 1–20s. Reduces empty responses. Preferred.
  • Delay Queue: Postpone new messages 0–900s.

Dead-Letter Queue (DLQ): After maxReceiveCount deliveries, messages move to DLQ. Same queue type required. Use Redrive to move messages back.

FIFO: MessageGroupId for ordered groups. MessageDeduplicationId or content-based deduplication.

SQS with Lambda: Lambda polls via event source mapping. Use ReportBatchItemFailures for partial batch success.

Practice Linked Questions


medium

Q1. A Lambda function processes messages from an SQS Standard Queue. After processing, some messages reappear in the queue and are processed multiple times. The developer has confirmed the Lambda is completing successfully. What is the most likely cause?


Select one answer before revealing.

medium

Q2. A developer is building an order processing system. Each customer's orders must be processed in the exact sequence they were placed. A customer may place multiple orders simultaneously. Which SQS configuration satisfies this requirement?


Select one answer before revealing.

easy

Q3. An SQS consumer receives a message, begins processing, but crashes before completing. The message visibility timeout is 30 seconds and the processing typically takes 45 seconds. What happens to the message?


Select one answer before revealing.

medium

Q4. A developer wants to delay all messages in an SQS queue by 90 seconds before they become available to consumers. Individual messages should be able to override this delay. Which SQS features should be used?


Select one answer before revealing.

hard

Q5. A Lambda function processes SQS messages in batches of 10. Occasionally, 2 messages in a batch fail while the other 8 succeed. Currently, the entire batch is returned to the queue on any failure. How should the developer fix this so that only the failed messages are retried?


Select one answer before revealing.

medium

Q6. A team wants to fan out a single SQS message to multiple processing pipelines simultaneously. Each pipeline has its own SQS queue. What is the recommended architecture?


Select one answer before revealing.

hard

Q7. A developer notices that some SQS messages are failing repeatedly and piling up, preventing new messages from being processed in a FIFO queue. What configuration prevents this?


Select one answer before revealing.