-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cold Start and Warm Start on Consumption Plan #131
Comments
Any updates on this? |
Preventing to change to cold-start mode is quite easy. Just add a time trigger function within the same function app which executes every 5 minutes. But be aware that this may cause additional costs if your free execution credit is exceeded. |
@mamaso suggested that "we may want to add info about https://github.com/christopheranderson/azure-functions-pack and Azure/azure-functions-host#298" to the Nodejs reference topic. |
Hi, I have the same kind of issue. I'm running some Azure Functions with HTTP Trigger. I noticed, very often that some functions take more than 10 secs to load and start my code. As you can see, I put Trace at the begining and the end of the function. My code takes 2.79sec to run, but the function takes 8sec to load. My functions use:
Sometimes, it takes 30sec with 100% CPU, just to load the function. |
I followed https://github.com/mikezks example, of 5 minutes pinging. Only change I did was
More info:
|
Is there any way to enable warm start so it will be accessible immidiately ? The periodical ping is a nice workaround but is really a hack. I am experiencing ~30 seconds warmup times |
Below are more details: Start:
Actual:
Hope that helps. |
Thanks @manoharreddyporeddy
Even with that it takes 1.2 minute (!) for my function to warm. I have used Lambda and Google Cloud Functions in the past and don't remember having this side effect or having to think about these things at all. First time I hear about this consumption plan, I will check that out thanks MS why not keeping things simple 😞 |
@mderazon Just saw this timely article about this: https://blogs.msdn.microsoft.com/appserviceteam/2018/02/07/understanding-serverless-cold-start/ |
Just changing into its own function app, should not change from ~30 seconds to 1.2 minute. Since, it has reverse effect, sure something else has also changed. In our experience:
Hope that helps. |
We used webpack to bundle the npm module dependencies into a single file to reduce the cold time, refer this medium article |
Thanks for the article |
The issue seems to be the number of files that get loaded, If you can reduce your file count (even if that means increasing file size) you'll see much better cold start times. The IOPS on the Storage Account File Storage seems to be low compared to its bandwidth. We used Webpack too, since we have a Node.js application. This also allowed us to move to Typescript with all the ES6 goodies and have babel do the polyfill. We went with something similar to this: Azure/azure-functions-host#298 (comment) but a bit more elaborate. We are also webpacking our non-http functions too. Maybe also look at func pack, Azure/azure-functions-host#298 (comment) Edit: Since you didn't state it, if you're on C#, the relative issue for that is here: Azure/azure-functions-host#838 |
Found a great new article (May 2018) with cold start testing stats for both infrequent and concurrent function calls. The results of this show that creating a "keep-it-warm" trigger for the function does not eliminate cold starts completely, especially for the concurrent function call use case. Just a heads up. |
Closing this as warm start times are so variable we have a best practices doc but nothing that states "expect x cold start" |
Hi, Team.
When I looked into the doco, https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale, it doesn't mention the starting time (or warm-up time) but 5 mins time limit in the comment block. I know a Function app doesn't take more than 5 mins long on Consumption Plan.
Here are my questions on Consumption Plan:
As far as I remember the Twitter conversation with @christopheranderson on the other day correctly, when no function is called on a Functions app with Consumption Plan for more than 5 mins, the Functions app goes into the idle mode. It gives me an implication that a new function call after 5 mins of no activity, ie the Functions app has gone into the idle mode, will do cold-start that would take longer than the warm-start.
In this situation, how much extent does the cold-start take longer than the warm-start, in general? It may depend on how complex the function is, by the way.
Cheers,
The text was updated successfully, but these errors were encountered: