DVA-C02 Question 397
Single answerYou are developing a serverless application that processes user-uploaded images. The application uses an Amazon S3 bucket to store the images and an Amazon Simple Queue Service (Amazon SQS) queue to coordinate processing tasks. You want to ensure that multiple processing systems can consume messages from the SQS queue concurrently. How can you achieve this?
- A
Configure the SQS queue as a standard queue and allow multiple consumers to poll the queue.
- B
Set up an Amazon SNS topic and subscribe multiple consumers to the topic.
- C
Use an SQS FIFO (First-In-First-Out) queue to ensure messages are processed in order by multiple consumers.
- D
Enable long polling on the SQS queue to allow multiple consumers to receive messages simultaneously.
Show answer and explanation
Correct answer: A
Explanation
Standard SQS queues are designed for high throughput and allow multiple consumers to poll the queue simultaneously, making them ideal for scenarios where different systems or instances need to process messages concurrently. This ensures scalability and efficient task distribution.
- A. Correct.
This is correct. Standard SQS queues allow multiple consumers to poll the queue and process messages concurrently, providing high throughput and scalability.
- B. Incorrect.
This is incorrect. While Amazon SNS can fan out messages to multiple subscribers, it is not suitable for use cases where message durability and guaranteed delivery are required, such as task processing. SQS is better suited for this scenario.
- C. Incorrect.
This is incorrect. FIFO queues ensure strict message ordering and exactly-once processing but are not designed for high-concurrency, multi-consumer scenarios. They have limited throughput compared to standard queues.
- D. Incorrect.
This is incorrect. While long polling reduces empty responses and improves efficiency, it does not inherently allow multiple consumers to process messages concurrently. It only improves the efficiency of message retrieval.