I have a lambda that keep experiencing cold start.
I configured the lambda to have 5 provisioned concurrency, as it was suggested as a possible solution, but the lambda still have cold starts.
What might be a possible explanation?
Maybe 5 provisioned concureency is not enough? (how can I know what will be a good amount of containers?)
How did you handle cold start?
Also, a very important question: how can I be sure it uses my lambdas? where can I monitor it?
thanks!
2
Answers
Some possible directions to avoid cold starts:
require('your-lib-name-here')
in node.js or via reflection in C#)You can definitely try the steps given by LiriB to optimize the cold start.
Also, you can monitor the the metrics for Invocations which will give you the clue of total Invocations:
Here is one of the sample code for metric:
{ "metrics": [ [ "AWS/Lambda", "Invocations", "FunctionName", "dataservice-funct-getclaimfreqpred", "Resource", "function_name:alias", { "color": "#2ca02c" } ], [ ".", "ConcurrentExecutions", ".", ".", ".", ".", { "color": "#9467bd" } ], [ ".", "Errors", ".", ".", ".", ".", { "stat": "Average", "color": "#ff7f0e" } ], [ ".", "Duration", ".", ".", ".", ".", { "stat": "Average", "color": "#1f77b4" } ] ], "view": "timeSeries", "stacked": false, "region": "region_name", "stat": "Sum", "period": 300, "title": "title" }
Additionally you can follow the auto-scaling-provisioning for auto-scaling