Reputation: 108
AWS Lambda Runtime: Python 3.7
The Lambda Layer attached to my Lambda has a capacity of nearly 200MB when decompressed.
I would like to know if this large capacity Lambda Layer will affect the uptime or cold start of Lambda machine.
Upvotes: 4
Views: 2925
Reputation: 322
Yes! The package size (including the layer) does affect the Init Duration
"cold-start" time
This is some benchmarking test on nodejs function with our without webpack (its a tool that helps to reduce the package size for nodejs). And we can see clearly how its effect the cold start init time:
The picture was taken from our blog in lumigo: https://lumigo.io/blog/this-is-all-you-need-to-know-about-lambda-cold-starts/ we have a detailed blog post about that issue, with solutions suggestion
Upvotes: 14
Reputation: 6934
Short answers: likely not, and not really.
On the lifetime (uptime) of Lambda instances of different memory sizes, I happened to run some experiments recently, https://xebia.com/blog/til-that-aws-lambda-terminates-instances-preemptively/. Bottom line: I could not find a correlation between instance size and lifetime, "Instances of 1024 MB had a comparable lifetime as instances of 256 MB, 512 MB, 1024 MB, and 2048 MB."
On the effect of instance size on the cold-start duration, Mikhail Shilkov posted some analysis, https://mikhail.io/serverless/coldstarts/aws/. Bottom line: "Most language runtimes have no visible difference in cold start duration of different instance sizes."
Upvotes: -3