Why running a lambda with custom image for the first time takes more time?

0

Hi,

I noticed the first time I am calling a lambda with a new custom image the "init duration" is usually between 3500 ms to 9600 ms. When not called for few minutes or days the cold start calls will have "init duration" between 800 ms to 2000 ms. It looks like the first cold start call is doing much more work than the subscequent calls. Are there optimisations happening or something during that first time only? For example, are the image layers cached for for faster access next time?

According to https://docs.aws.amazon.com/lambda/latest/operatorguide/execution-environments.html#cold-start-latency, customers are not supposed to be charged for the first 2 steps "download code" and "start new execution environment". Why are customers charged for that extra work/latency in the "init" the first time (see screenshot below)?

Lambda billed duration very high the first time only

Note there is no initiatlization code in the function used for testing https://github.com/Ducharme/awsCustomLambdas (node:20-bookworm with PROJECT_NAME=salut in config file set_project_values.sh)

Claude
질문됨 8달 전120회 조회
답변 없음

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

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

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

관련 콘텐츠