Timeout and memory in lambda function

amitiwary999

Amit Tiwary

Posted on April 23, 2022

Timeout and memory in lambda function

In this blog post I added how we can handle the duplicate invocation in lambda. I use nodejs to write lambda handle function and upload the zip file to AWS lambda. AWS Lambda require some trigger to run the code. You can use cloud watch events as trigger, Amazon SQS queue or API gateway. After trigger, lambda function starts runing the code and execute it. Sometimes it happen that execution of lambda function stop, even if there is no error. It happen when the assigned memory or timeout is not enough to execute the lambda function completly. For example, in lambda function you added code to fetch some data and then do some operation on it. When data fetch completed, data remains in mempry so that we can do operation on it. If the the assigned memory is not enough, lambda function will stop. Similialry executing the code takes time and if timeout is very low then it might possible that lambda function stop after timeout wothout executing the full code. To solve this problem, you can increase the timeout or memory from the general configuration. There is option to test the lambda function. So from test tab, you can click on test button to check if the function has any issue or not. You can use the same to check if the assigned memory and timeout is good enough to execute the code completely. You charged based on amount of time lambda function takes to execute code and memory. So make sure you are not over assigned or under assigned the memory.

💖 💪 🙅 🚩
amitiwary999
Amit Tiwary

Posted on April 23, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related