- Newest
- Most votes
- Most comments
There can be many factors attributing to this latency, such as runtime, memory allocation, cold start etc. I am assuming it's not running within VPC, if so, then VPC configuration can be another factor to this delay.
I'd suggest you to go through these two documentations and blog post:
- Understanding of lambda execution environments
- Configuring provisioned concurrency
- Blog Post - Operating Lambda: Performance optimization
Did you try to set provisioned concurrency to this lambda function, if not then give that a try and see if it reduces the delay. Very common cause of such delays can be cold start and with provisioned concurrency, this can be avoided up to an extent.
Edit: Please take a look at async-custom-metrics. Also, if you want to dig deeper into this, consider using X-Ray traces for this lambda function. In X-Ray traces, you can see how much time it took, timestamp when you ran the function and actual timestamp when your lambda code executed. Difference of this is the time of initialization, where it'd have resolved all the code dependencies, resource allocation etc.
Comment here if you have additional questions, happy to help.
Abhishek
Relevant content
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
- What's the difference between Lambda function execution role permissions and invocation permissions?AWS OFFICIALUpdated 2 years ago
thank you for your response. what I suggest is so important and help a lot comprehension how to ameliorate the function runtime. But my truly issue, is how I can detect exactly the route cause of my latency, is there a tool, service... that can show me what is the root cause, example the time that the cold start took, the time to communicate with the dynamo...
Sorry for delayed response. Did you take a look at async-custom-metrics. Also, if you want to dig deeper into this, consider using X-Ray traces for this lambda function. In X-Ray traces, you can see how much time it took, timestamp when you ran the function and actual timestamp when your lambda code executed. Difference of this is the time of initialization, where it'd have resolved all the code dependencies, resource allocation etc. I'm adding this to my answer as well for better community experience. Please do let me know if you have anything further, I'd be happy to help.
catching Traces with aws X-ray , I found that the spending time is about 12.63 invocation time = 12.63 overhead time = 2ms
Did you try setting up provisioned concurrency and then compare the results.
yes, but nothing has changed