An image processing application uses an Amazon SQS standard queue to decouple a web front-end from EC2 worker instances. The worker instances retrieve messages from the queue, download a high-resolution image from Amazon S3, perform CPU-intensive image compression, and upload the processed image back to S3. Currently, the SQS queue's default visibility timeout is configured to seconds. However, for large images, the compression process can take up to minutes ( seconds). As a result, other worker instances frequently retrieve the same image message while it is still being processed by the first worker, leading to duplicate processing. Which of the following actions should the developer take to resolve this issue? (Select TWO.)
- Increase the default visibility timeout of the SQS queue to seconds.Cevap
- Modify the worker application code to call the ChangeMessageVisibility API, extending the visibility timeout while the image is being processed.Cevap
- CSet the DelaySeconds attribute of the SQS queue to seconds.
- DIncrease the SQS queue's ReceiveMessageWaitTimeSeconds parameter to seconds.
- EConfigure a dead-letter queue (DLQ) with the maxReceiveCount set to on the source SQS queue.
Cevap
Increase the default visibility timeout of the SQS queue to seconds, and modify the worker application code to call the ChangeMessageVisibility API to extend the visibility timeout while the image is being processed.
Increasing the default visibility timeout to seconds ensures the message remains hidden from other consumers for the duration of the -second processing window. Alternatively, using the ChangeMessageVisibility API dynamically extends the visibility timeout during active processing, which is ideal for workloads with variable processing times. Both approaches prevent other workers from retrieving the message concurrently.
Adım Adım Çözüm
Anahtar Kavram
Amazon SQS Message Visibility Timeout management