Reza MT
Reza MT

Reputation: 1

AWS Lambda Function Times out

I have developed a nodejs lambda function on AWS responsible for calling two backend (SOAP Services) services deployed on EC2 Machines.

The first two calls to my lambda functions times out but the rest are fines. This event will happen again when I don't call lambda for about an hour or so.

I have read about lambda standby stuff, but I am not sure what is the right solution for this problem.

Would you please give me your opinion on this.

Thanks.

Upvotes: 0

Views: 148

Answers (1)

E.J. Brennan
E.J. Brennan

Reputation: 46879

When you call a Lambda function often, it tend to stay 'in memory', ready for the next execution - but when you don't call it for a while, the first call after that delay tends to take a lot longer to startup.

The typical solution is to increase the memory size for the lambda function. A Lambda with more memory also gets more CPU - so even if your function will not need the extra memory, it will start faster after a cold start.

Q: How are compute resources assigned to an AWS Lambda function?

In the AWS Lambda resource model, you choose the amount of memory you want for your function, and are allocated proportional CPU power and other resources. For example, choosing 256MB of memory allocates approximately twice as much CPU power to your Lambda function as requesting 128MB of memory and half as much CPU power as choosing 512MB of memory. You can set your memory in 64MB increments from 128MB to 1.5GB.

from here: https://aws.amazon.com/lambda/faqs/

Upvotes: 1

Related Questions