1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
Lambda Execution environments stay warm for a few minutes after the last invocation. It may be that they were still warn. You can verify this by looking at CloudWatch Logs to check if the functions have Init Duration (which indicates a cold start), or not.
Also, make sure that you set the view on Maximum for Concurrency invocations and not Count.
Contenus pertinents
- demandé il y a 7 mois
- demandé il y a un an
- demandé il y a 7 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
Hi Uri, is provisioned concurrency considered warm start? We configured 1 provisioned concurrency for one of our Lambda functions that requires low latency. We make sure only 1 request is sent at any time. But the first request's response time is still very long (about 3s). Subsequent request's response time is only around 500ms. This pattern repeats after a long break between the requests. The 1 provisioned concurrency is kept active all the time. Why are we getting the long response time for the first request even with provisioned concurrency? How to reduce it? Thanks.
I am guessing that your function has some init code that happens inside the handler. You should do all initialization code. e.g., read config, open database connections, etc., outside the handler. This way, they will be invoked during the deployment, and not during the first invocation.
Also, if your init code is outside the handler, and if you are using Node.js, use top level await to make sure that all the initialization is done in a synchronous way. Otherwise, the actual init will happen with the first invoke.
Thank you Uri! We'll try to optimise our code as you suggested.