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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南