Don’t overprovision your Lambda functions

Serverless Tip #17: Don’t overprovision your Lambda functions

For Lambda functions, you can not directly set the CPU you want your functions to have. Instead, you pick a memory configuration between 128 MB and 10 GB, and your function will get CPU performance proportional to that.

With Lambda, you are billed for GB-seconds. Increasing the memory can reduce your execution times while keeping costs constant if your function is CPU-bound.

If your function code cannot use multiple cores, giving them too much memory will only increase costs without increasing performance.

Want to know how much CPU you’ll have at each memory breakpoint? While the actual numbers are not documented by AWS, an old study found the following:

Memory (MB)vCPUCPU Ceiling
83220.50
176921.00
300821.67
300931.70
530732.39
530842.67
707642.84
707753.86
884554.23
884664.48
1024064.72

So, for a single-threaded application, going above 1769 MB might not have any effect on your execution times, unless you need the extra memory.

To find the optimal configuration for your functions regarding cost vs. performance, profile them with the AWS Lambda Power Tuning tool.