AWS Developer DVA-C02 · Troubleshooting and Optimization · medium
An Amazon SQS standard queue has its default VisibilityTimeout set to 30 seconds. A worker EC2 instance polls the queue, receives a video-transcoding message, and takes 75 seconds to finish transcoding the video before calling DeleteMessage. Because 75s > 30s, every video is transcoded two or three times by other workers! Which two solutions prevent duplicate processing while handling messages that occasionally take longer than expected? (Select two.)
Published · Last updated · checked before publication — how we verify questions
Options
Answers: A. Increase the SQS queue's VisibilityTimeout to exceed the 75-second processing time; C. Call the ChangeMessageVisibility API from the worker to extend the timeout
To prevent a message from becoming visible again while a consumer is still actively processing it, you should (B) increase the queue's VisibilityTimeout above the maximum expected processing time (e.g., 120–300 seconds, up to 12 hours) (A), and/or (C) have the worker call the ChangeMessageVisibility API heartbeat dynamically to extend the timeout for individual long-running messages while still in flight (C).
Why the other options are wrong
- B. Increase the SQS ReceiveMessage WaitTimeSeconds (Long Polling) parameter to 20s — WaitTimeSeconds controls how long ReceiveMessage waits for an empty queue to receive a message, not how long an in-flight message stays hidden.
- D. Set the SQS DelaySeconds attribute to 900 seconds on the dead-letter queue — DelaySeconds delays initial visibility of newly enqueued messages; it does not stop an in-flight message's 30s visibility timer from expiring.
More Troubleshooting and Optimization questions
- A backend application uses Amazon ElastiCache for Redis in front of an Amazon RDS PostgreSQL database. Whenever the…
- Hundreds of short-lived AWS Lambda functions concurrently open and close new TCP database connections to an Amazon RDS…
- A developer wants their AWS Lambda function to emit custom business metrics (OrderValue, CheckoutLatencyMs) alongside…
- An AWS Lambda function processes CPU-intensive image resizing and takes 4,000 ms (4.0 seconds) when configured with…
- A developer instruments a microservices payment API with the AWS X-Ray SDK. They want to attach custom key-value data…
All Troubleshooting and Optimization questions and the topic overview →
AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.