- Newest
- Most votes
- Most comments
Time taken for Lambda execution will have multiple factors like memory, cpu, network involved. The screenshot shared indicates that the operation you are performing is not memory intensive as it is consuming only small portion of total memory allocated. When a Lambda function is invoked, the function will be allocated with the maximum memory configured and equivalent vCPUs allocated i.e. every 1769MB of memory allocated will have 1vCPU allocated.
You can increase the memory to maximum allowed value of 10240MB and test if it improves the performance with little more additional vCPU added. Also, suggest you to look at optimizing the function by identifying the code snippet taking time. If it has any network calls involved or extensive computations involved, it may be ideal to increase the timeout value.
You can also, create functions with both x86_64 and ARM processors to compare the performance and choose the best one for your function.
You can also opt-in for the Compute Optimizer recommendations (only supports x86_64 based functions at this time) - https://docs.aws.amazon.com/compute-optimizer/latest/ug/getting-started.html?icmpid=docs_lambda_help#account-opt-in https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html?icmpid=docs_lambda_help#requirements-lambda-functions
Also, can profile the functions - https://docs.aws.amazon.com/lambda/latest/operatorguide/profile-functions.html
The Lambda services doesn't determine nor control the amount of memory that your function uses - that's up to the code that you write; the libraries you use and the runtime that you're running the code in.
If you're having issues where the code is behaving inconsistently (and in this case timing out because there's something going wrong) I'd suggest debugging all of the things above to find out where the issue is. But Lambda itself will not "force" your code to use any resources that you give it; it's up to the code to do that.
Relevant content
- asked 2 years ago
- asked 6 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 3 years ago