How long does AWS Lambda keep your idle functions around before a cold start?
Yan Cui

This is very interesting, thanks for sharing this!

I had reached out to AWS support about reusing resources across Lambda invocations, they explained that Lambda functions will not be cold-started (and therefore, shared files / variables will persist) if they are invoked frequently enough and an easy way to tell when a cold start has occurred is to watch the Log Streams in CloudWatch: Each new Log Stream indicates a fresh Lambda container. When I watch my Log Streams, it seems like new ones spawn up after every couple minutes of inactivity.

Have you seen similar behavior with your Log Streams from this experiment?

I may have missed it in this post, but how does your system-under-test function determine whether or not a cold start occurred? I’m assuming this is the part that does not line up with the Log Stream theory.

Like what you read? Give Devin Bhushan a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.