Question 1 · choose 1
An image-resizing AWS Lambda function is configured with 512 MB of memory. Its REPORT log lines show about 4 seconds of duration and about 180 MB of maximum memory used, and profiling shows that the time is spent on CPU-bound image processing. The team wants shorter durations at the lowest cost that the data supports. What should the developer do?
- AKeep 512 MB, because the function uses only 180 MB of its memory
- BMeasure several memory sizes, such as with Lambda Power Tuning, and pick the best
- CAdd provisioned concurrency so that each invocation starts on a warm environment
- DRaise the function's ephemeral storage in /tmp to 10,240 MB
Show the answer and why
AKeep 512 MB, because the function uses only 180 MB of its memory
Incorrect
Max Memory Used shows memory is not the limit, but CPU scales with the memory setting, so a CPU-bound function can still get faster with more.
BMeasure several memory sizes, such as with Lambda Power Tuning, and pick the best
Correct
More memory brings an equivalent increase in CPU. Performance testing across memory sizes, which AWS suggests doing with Lambda Power Tuning, finds the setting with the best duration and cost.
CAdd provisioned concurrency so that each invocation starts on a warm environment
Incorrect
Provisioned concurrency cuts initialization latency. It does not add CPU to the work done inside the handler.
DRaise the function's ephemeral storage in /tmp to 10,240 MB
Incorrect
Ephemeral storage is disk space in /tmp. It does not change the CPU available to the function.
For Lambda, memory is the CPU knob; measure several settings instead of guessing, and use Max Memory Used and duration to judge them.
AWS documentation