AWS Certified Developer – Associate — Question 400

A developer has created on AWS Lambda function tool uses 15 MB of memory. When the developer runs the code natively on a laptop that has 4 cores, the function runs within 100 ms. When the developer deploys the code as a Lambda function with 128 MB of memory, the first run takes 3 seconds. Subsequent runs take more than 500 ms to finish.
The developer needs to improve the performance of the Lambda function so that the function runs consistently in less than 100 ms, excluding the initial startup time.
Which solution will meet this requirement?

Answer options

Correct answer: C

Explanation

AWS Lambda allocates CPU power proportionally to the amount of configured memory. At 128 MB of memory, the function receives a very small fraction of a CPU core, causing the CPU-bound code to run slowly compared to the developer's 4-core laptop. Increasing the memory allocation will proportionally increase the CPU performance, allowing the function to execute within the target 100 ms threshold.