
Answer-first summary for fast verification
Answer: Limit function concurrency to one and use ElastiCache to store and calculate the rolling average.
The correct answer is A. By setting the function's reserved concurrency to 1, you ensure that only one instance of the Lambda function processes messages at any given time. This sequential processing is crucial for calculating an accurate rolling average. Storing the calculated rolling average in Amazon ElastiCache also helps maintain state across invocations, addressing the stateless nature of Lambda functions and avoiding inaccuracies due to concurrent executions.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
An AWS Lambda function in a VPC polls an SQS queue via a VPC endpoint to calculate a rolling average of numeric message values. The developer encounters inaccuracies in the calculated average. What is the best approach to ensure accurate calculations?
A
Limit function concurrency to one and use ElastiCache to store and calculate the rolling average.
B
Utilize ElastiCache to maintain message values for initializing and calculating the rolling average.
C
Set provisioned concurrency to one and use ElastiCache for rolling average storage and calculation.
D
Store message values in Lambda layers for initializing and calculating the rolling average.
No comments yet.