Question

Difficulty: MediumAWS Compute Optimizer and Right-Sizing

A company runs a CPU-bound data processing workload using an AWS Lambda function. The function is currently configured with 512 MB of memory and is experiencing execution delays, occasionally timing out. A SysOps Administrator reviews AWS Compute Optimizer, which flags the function as under-provisioned and recommends increasing the memory to 1024 MB. The administrator notes that the function's peak memory utilization is only 200 MB. Which action should the administrator take to resolve the performance bottleneck in a cost-effective manner?

  1. A
    Enable Amazon CloudWatch detailed monitoring to capture memory utilization metrics at 1-minute intervals before modifying the configuration.
  2. B
    Use AWS Cost Explorer to configure a cost anomaly detection alert for the Lambda function to automatically scale the memory when utilization spikes.
  3. Increase the memory configuration of the Lambda function to 1024 MB to allocate more CPU power and decrease execution time.Answer
  4. D
    Configure an AWS Config rule to trigger an AWS Systems Manager Automation document that automatically lowers the memory to 256 MB to match the active memory footprint.

Answer

Increase the memory configuration of the Lambda function to 1024 MB to allocate more CPU power and decrease execution time.
The correct option is to increase the memory configuration to 1024 MB. AWS Lambda allocates CPU power proportionally to the configured memory. Since the workload is CPU-bound, increasing the memory allocation will increase the CPU power available to the function, which significantly speeds up the execution and resolves timeouts. Often, this can also reduce the overall cost because the execution finishes much faster.

Step-by-Step Solution

1
Analyze the workload characteristics and identify the bottleneck.
The workload is CPU-bound, but the Lambda function is currently constrained by its CPU allocation, causing execution delays.
AWS Lambda allocates CPU power proportionally to the configured memory size. At 512 MB, the function has half the CPU share of a 1024 MB configuration.
2
Evaluate AWS Compute Optimizer recommendations.
AWS Compute Optimizer recommends increasing the memory to 1024 MB, despite the low actual memory footprint of 200 MB.
Compute Optimizer models the execution time and costs of the function across different memory sizes to find the optimal point where execution speed increases enough to justify the higher cost per millisecond.
3
Apply the right-sizing recommendation to the function configuration.
The Lambda function memory is updated to 1024 MB, which increases CPU capacity, speeds up execution, resolves the timeouts, and minimizes total cost.
By reducing the total duration of the CPU-bound task, the overall execution cost may remain similar or decrease, while ensuring performance compliance.

Key Concept

Proportional CPU allocation in AWS Lambda and right-sizing CPU-bound workloads via AWS Compute Optimizer
Estimated Time:1m 30s
Rate this question