Hey, I was just curious about this and there were ...
# help
a
Hey, I was just curious about this and there were no specific answers that I could find so I am asking here, are lambda cold start times something that I should bother about. My API currently is a REST API and I’ve a different lambda function for every resource URL. I am going to move to AWS AppSync later but how big of problem are lambda cold starts and do lambda cpu / memory configuration affect it in any way?
r
It depends on your use case and your users. Also, the infrastructure that sits behind those lambdas. We don't find it to be a problem if an occasional response takes a few hundred milliseconds. Also there are various ways to mitigate and you can use provisioned concurrency to maintain warm lambdas if you don't mind the cost
a
okay, I understand. I’ll use x-ray and track my requests / responses. I am not expecting any uniform load as of now and most of my traffic would be in bursts, created due to promotion through my marketing teams. The db layer is dynamo-db and so it’ll be blazing fast, again not a concern, I think I should wait for some insights about how my APIs are performing before I think about optimising them. Thanks @Ross Coundon.
f
From our experience, the Lambda package size seems to impact the cold start time.
You can find that out easily if you run
sst build
and look inside
.build/cdk.out
. All the Lambda zips are in there. We try to keep most of our zips <5MB. Most zips are 1-2MB.
r
Yep, Frank's right. A useful analysis here https://mikhail.io/serverless/coldstarts/aws/
a
Awesome, good point, I’ll keep this in mind.