How do i force a cold start of an AWS lambda function?

0

each warm run of the function adds about 1 mb of used memory. If any function instance remains warm long enough then any allocated memory values will be exceeded and the lambda operation will stop. So if my application calls lambda once a minute I am guaranteed that the service will not work.

How (I have a python function) can I force the cooling of individual lambda instances?

profile picture
boter
질문됨 일 년 전295회 조회
1개 답변
0

If your warm lambda function is accumulating memory for each execution, then it is not being idempotent. It means that every execution it is not unique and the result out of it is changing after each execution.

I would recommend to review the source code to make sure that your lambda is following the best practices when it comes to idempotency.

Take a look into this blog post [1] along with this article [2] which covers this topic.

Now if you really want to know how to cold start your lambda

The answer is easy, Make it fail. Every time that a lambda fails, the underlying container running your code gets terminated and a new one is created. This is not recommended to solve your concern, but for your knowledge, this is what happens when a lambda fails.

I hope this information is useful


Handling Lambda functions idempotency with AWS Lambda Powertools

[1] https://aws.amazon.com/blogs/compute/handling-lambda-functions-idempotency-with-aws-lambda-powertools/

How do I make my Lambda function idempotent?

[2] https://repost.aws/knowledge-center/lambda-function-idempotent

profile pictureAWS
전문가
Sercast
답변함 8달 전

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

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

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