Topic 1 Question 98
An image-processing company has a web application that users use to upload images. The application uploads the images into an Amazon S3 bucket. The company has set up S3 event notifications to publish the object creation events to an Amazon Simple Queue Service (Amazon SQS) standard queue. The SQS queue serves as the event source for an AWS Lambda function that processes the images and sends the results to users through email. Users report that they are receiving multiple email messages for every uploaded image. A solutions architect determines that SQS messages are invoking the Lambda function more than once, resulting in multiple email messages. What should the solutions architect do to resolve this issue with the LEAST operational overhead?
Set up long polling in the SQS queue by increasing the ReceiveMessage wait time to 30 seconds.
Change the SQS standard queue to an SQS FIFO queue. Use the message deduplication ID to discard duplicate messages.
Increase the visibility timeout in the SQS queue to a value that is greater than the total of the function timeout and the batch window timeout.
Modify the Lambda function to delete each message from the SQS queue immediately after the message is read before processing.
ユーザの投票
コメント(17)
- 正解だと思う選択肢: C
answer should be C, users get duplicated messages because -> lambda polls the message, and starts processing the message. However, before the first lambda can finish processing the message, the visibility timeout runs out on SQS, and SQS returns the message to the poll, causing another Lambda node to process that same message. By increasing the visibility timeout, it should prevent SQS from returning a message back to the poll before Lambda can finish processing the message
👍 30Six_Fingered_Jose2022/10/24 - 正解だと思う選択肢: C
this is important part: Immediately after a message is received, it remains in the queue. To prevent other consumers from processing the message again, Amazon SQS sets a visibility timeout, a period of time during which Amazon SQS prevents other consumers from receiving and processing the message. The default visibility timeout for a message is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours.
👍 11brushek2022/10/12 - 正解だ と思う選択肢: B
Increasing the visibility timeout only stops other consumers of the queue from seeing that message until it is handled and deleted.
However in our case
- there are duplicate messages in the queue!! So I do not see how increasing the visibility handles this issue.
- The question clearly calls out that a 'standard queue' is being used so the reader will think of this issues caused by a standard queue... which is order of order and DEDUPLICATION.
The also do not mention performance as an issue, which might be a reason not to use FIFO.
The only issue I have with 'B' as an answer is it says
'change' the standard to FIFO. technically you cannot switch to a FIFO queue once its created... but you can at a higher level change the architecture to use a FIFO queue.
👍 5MrAWS2023/01/15
シャッフルモード