In the previous section, we saw how testing your function at scale with different memory settings results in more CPU capacity allocated, which could impact your Lambda function's performance and cost. However, before optimizing the resource usage, you need to optimize your function's code first to help reduce the amount of memory and CPU it needs in order to be executed. Contrary to traditional applications, AWS Lambda manages and patches the infrastructure for you, which allows developers to focus on writing good quality, efficient, and world-class code that executes fast.
Allocating more resources to your function can result in faster executions until a certain threshold, where adding more memory will no longer provide better performance.
The following are some points you should keep in mind when designing your function with AWS Lambda in a cost...