lambda cold start & synchronous execution

0

Hi,

If there is a lambda that is being called frequently enough so that there is always at least one container warm, is there ever a scenario where I could invoke the lambda enough times synchronously, that one (or more) of my invocations could be hit with a warm-up delay while additional containers are spun to handle the load?

Also how many synchronous executions of a lambda will execute on a single container?

For example, if I had a lambda that took 30 seconds to execute and required 256mb – when the first container is created for this lambda to run, how many concurrent threads (each consuming 256mb) would I expect the first container to be able to handle? If I simultaneously call the lambda 100 times, will they all execute on the warm container? Or will more containers be created, and will those subsequent containers cause a warm-up delay in some of the invocations? Alternatively, if I started cold, and then started invoking the lambda consistently every 100ms, will some of these invocations other than the first exhibit a warm-up delay?

AWS
asked 6 years ago461 views
1 Answer
0
Accepted Answer

Each lambda execution runs in it's own container. So if you have one warm container and you have a spike in lambda invocations in a short enough time to increase your concurrency you'll get a cold start for the new containers. For example if your concurrency is 1 and have a burst of traffic that raises your concurrency to 10 you'll see 9 cold-starts. This blog is a great resource for understanding how all of this works. I'd also encourage you to look through the lambda best practices as they detail lots of steps that help reduce the cold-start time.

AWS
EXPERT
Adam_W
answered 6 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions