How long does a lambda instance can keep 'warm'?

1

Hi all,

I would like to ask how long does a lambda instance can keep 'warm'. AWS lambda document has an explanation about cold start and warm start, but it seems that it does not explain the warm duration. I search on the Internet but there are many different answers as well. Most people say the warm duration is 5~15 mins. Lamda can set the timeout, the timeout duration is up to 15 mins. However, I think it limits the lambda runtime time and does not represent the duration of warm time.

Thanks.

han
질문됨 2년 전14366회 조회
3개 답변
4

You are correct, the timeout doesn't directly impact how/when a container is reused. The number of cold starts you're gonna experience (ie when a new container will be spinned up) will depend on usage pattern and parallel requests landing on your function - this is why we don't disclose an hard number.

This blog includes some details you might find useful.

For use cases where you can't really afford cold starts, you should take a look at Provisioned Concurrency too.

AWS
답변함 2년 전
profile pictureAWS
전문가
검토됨 2년 전
  • Wrong link Giorgio? It points to an ALB doc page.

  • Got it. Thanks. I am also confused that if I have two lambda functions and they are in waiting state, does lambda will choose the function that has less waiting time to handle the next coming request?

0

I can add to Giorgio's answer that it also depends on the size of a lambda.

Smaller lambdas are usually warm longer because Lambda is always at least the size you chosen.

So the bigger the lambda is the smaller amount of containers are available.

profile picture
MG
답변함 2년 전
  • Smaller lambdas are usually warm longer because Lambda is always at least the size you chosen. -- That's not fully accurate. If you have 10 active sandboxes of 128mb vs 10gb, we will not differentiate if you continue to use both at the same rate. Use can be "ping" or can be actually use.

  • That's not what I mean :) I just wanted to say, that the need for bigger containers is higher because all smaller lambdas fit to them. It means if you configure lambda to be 128mb, then all containers are valid if your lambda needs to be launched. But if you have 10gb lambda, then only 10gb containers can be used that usually means that your lambda will be warm for a shorter amount of time, but it depends soooo much on the whole AWS infra plus what other clients are deploying to Lambda service etc. So yes, it's not so obvious and easy to estimate. It's better to not rely on such assumptions at all.

0

To add some notes on @Giorgio and MG's answers

As this duration theoretically depends on the aws infrastructure and can be varied time by time i propose highly to experience these kind of limits by monitoring the exact case,

i ca confirm that the 128Mo lambda was releases after 40min in my first test by after a while i recognized different duration.

As MG mentioned above , the size can change your release duration and well as speed,

i would like to mention again, in serverless world try to monitor and experience

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠