DVA-C02 Question 393
Single answerYou are developing a serverless application using AWS Lambda to process orders. The Lambda function is invoked by an Amazon SQS queue, which receives hundreds of orders per second. You notice that the function does not process messages fast enough and there is a growing backlog of unprocessed messages in the queue. Which configuration change should you make to optimize the concurrency of your Lambda function?
- A
Increase the batch size setting in the event source mapping for the SQS queue.
- B
Set a reserved concurrency limit on the Lambda function.
- C
Decrease the visibility timeout value of the SQS queue.
- D
Enable FIFO mode for the SQS queue.
Show answer and explanation
Correct answer: A
Explanation
In this scenario, the Lambda function is invoked by an Amazon SQS queue, and the backlog of unprocessed messages indicates that the function is not processing messages quickly enough. Increasing the batch size in the event source mapping allows the function to process more messages per invocation, improving throughput and reducing the backlog. This is the most effective way to address the concurrency issue in this case.
- A. Correct.
Correct: Increasing the batch size allows the Lambda function to process more messages per invocation, reducing the backlog and improving concurrency.
- B. Incorrect.
Incorrect: Setting a reserved concurrency limit restricts the number of concurrent executions, which could further limit throughput instead of optimizing it.
- C. Incorrect.
Incorrect: Decreasing the visibility timeout could lead to duplicate processing of messages if the function does not complete in time, and does not directly improve concurrency.
- D. Incorrect.
Incorrect: Enabling FIFO mode changes the queue’s ordering guarantee but does not address the concurrency issue or the backlog of unprocessed messages.