
Answer-first summary for fast verification
Answer: Configure provisioned concurrency for the Lambda function to respond immediately to the function's invocations
Overall explanation Correct option: Configure provisioned concurrency for the Lambda function to respond immediately to the function's invocations When Lambda allocates an instance of your function, the runtime loads your function's code and runs the initialization code that you define outside of the handler. If your code and dependencies are large, or you create SDK clients during initialization, this process can take some time. When your function has not been used for some time, needs to scale up, or when you update a function, Lambda creates new execution environments. This causes the portion of requests that are served by new instances to have higher latency than the rest, otherwise known as a cold start. By allocating provisioned concurrency before an increase in invocations, you can ensure that all requests are served by initialized instances with low latency. Lambda functions configured with provisioned concurrency run with consistent start-up latency, making them ideal for building interactive mobile or web backends, latency-sensitive microservices, and synchronously invoked APIs. Functions with Provisioned Concurrency differ from on-demand functions in some important ways: Initialization code does not need to be optimized. Since this happens long before the invocation, lengthy initialization does not impact the latency of invocations. If you are using runtimes that typically take longer to initialize, like Java, the performance of these can benefit from using Provisioned Concurrency. Initialization code is run more frequently than the total number of invocations. Since Lambda is highly available, for every one unit of Provisioned Concurrency, there are a minimum of two execution environments prepared in separate Availability Zones. This is to ensure that your code is available in the event of a service disruption. As environments are reaped and load balancing occurs, Lambda over-provisions environments to ensure availability. You are not charged for this activity. If your code initializer implements logging, you will see additional log files anytime that this code is run, even though the main handler is not invoked. Provisioned Concurrency cannot be used with the $LATEST version. This feature can only be used with published versions and aliases of a function. If you see cold starts for functions configured to use Provisioned Concurrency, you may be invoking the $LATEST version, instead of the version or alias with Provisioned Concurrency configured.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
The customer feedback system for a company's premier web application relies on a REST API created using Amazon API Gateway. This API triggers an AWS Lambda function responsible for processing the feedback. While the current performance of this Lambda function is acceptable, the development team has been assigned the task of reducing the function's startup time to enhance the user experience even further.
What strategies would you employ to optimize the AWS Lambda function for faster initialization?
A
Configure provisioned concurrency for the Lambda function to respond immediately to the function's invocations
B
Configure reserved concurrency to guarantee the maximum number of concurrent instances of the Lambda function
C
Enable API caching in Amazon API Gateway to cache AWS Lambda function response
D
Configure an interface VPC endpoint powered by AWS PrivateLink to access the Amazon API Gateway REST API with milliseconds latency