Development with AWS Services

A Lambda function configured with 512 MB of memory performs CPU-bound calculations and exceeds its latency target, although peak memory use is only 180 MB. Which configuration change should the developer benchmark to reduce individual invocation duration?

Show the answer

Correct answerB. Increase the function's memory allocation.

AWhy not this: A longer timeout permits longer execution but does not make calculations finish sooner.

BWhy this is right: Increasing configured memory also increases CPU capacity and can reduce CPU-bound execution time.

CWhy not this: Reserved concurrency controls simultaneous executions, not CPU capacity per execution.

DWhy not this: Ephemeral storage increases temporary disk capacity, not the CPU allocation for calculations.

Lambda allocates CPU capacity in proportion to configured memory, so increasing memory can accelerate CPU-bound work even when memory use is low. Increasing reserved concurrency permits more simultaneous invocations but does not add CPU capacity to an individual invocation.