A developer is troubleshooting a serverless application where an Amazon SQS queue triggers an AWS Lambda function to process batch invoice reports. Under normal load, the invoices are processed successfully. However, during peak hours when processing times increase, the developer notices that some invoices are generated multiple times. CloudWatch logs show that the Lambda function occasionally runs for up to seconds before completion, which is close to its configured timeout. The SQS queue's visibility timeout is currently set to seconds. Which configuration change will resolve this duplicate processing issue?
- Increase the SQS queue's visibility timeout to at least seconds.Cevap
- BReduce the Lambda function's execution timeout to seconds.
- CConfigure a Dead-Letter Queue (DLQ) on the SQS queue with a maxReceiveCount of .
- DIncrease the SQS queue's visibility timeout to seconds.
Cevap
Increase the SQS queue's visibility timeout to at least seconds.
The correct option addresses the timeout mismatch by setting the SQS visibility timeout to seconds, which satisfies the AWS best practice of maintaining the queue's visibility timeout at least times the Lambda function's timeout. This prevents SQS from delivering the same message to another Lambda execution thread while the active thread is still processing the invoice.
Adım Adım Çözüm
Anahtar Kavram
SQS visibility timeout configuration when integrated with Lambda