Exams / DVA-C02 / Concurrency and performance tuning / Question 2
DVA-C02 practice question: Concurrency and performance tuning (2 of 3)
Troubleshooting and Optimization A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.
A Lambda function that resizes images is configured with 256 MB of memory. CloudWatch shows that it uses only about 150 MB, but its duration is long because the work is CPU-intensive. What is the simplest way to make the function run faster?
Choose one answer.
- AA. Reduce the memory to 160 MB, because the function does not use the rest.
- BB. Increase the function timeout so it has more time to finish.
- CC. Add reserved concurrency so each invocation gets a dedicated CPU.
- DD. Increase the memory setting, which also gives the function more CPU.
Show the answer and explanation
Answer: D
- A. Wrong: Lambda allocates CPU in proportion to memory, so less memory would make the function even slower.
- B. Wrong: A longer timeout lets the function run longer. It does not make it run faster.
- C. Wrong: Reserved concurrency controls how many instances can run at once, not how much CPU each one gets.
- D. Right: Correct. CPU power scales with configured memory, so a CPU-bound function runs faster.
Explanation
Lambda has no separate CPU setting. CPU is allocated in proportion to memory, so CPU-bound functions often benefit from more memory even when they do not use it. Tools such as AWS Lambda Power Tuning help find the best memory setting.
Study
Keep practising
Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.