Why is AWS Lambda resetting every ~2hrs even with regular ping from EventBridge?

Viewed 14

I have a Lambda function that has an unacceptably long start-up time due to large files being transferred on initialisation. Once this is done, the actual data processing is very quick

I've set up a rule with EventBridge that keeps the function warm by sending a dummy request every 4 minutes. I've set these dummy requests up such that they only take a few ms after the initial request.

For this most part this seems to be working well - on the logs I see one long request and then all of the ones afterwards are quick.

However, I notice that every 128 minutes I get another long request, as if the Lambda function is 'resetting', despite the warming rule.

Does anyone know why this is happening? I don't understand why I'm getting these intermittent long requests if the function is being kept warm..

1 Answers

A lambda function instance has a maximum lifetime of about 2 hours even if it's in use. If you want to keep an instance alive then you should use provisioned concurrency.

Related