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
已提问 6 年前469 查看次数
1 回答
0
已接受的回答

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
专家
Adam_W
已回答 6 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则