Closed justinyoo closed 5 years ago
Any updates on this? I'm experiencing 7 seconds delays in Functions (HTTP triggered) bettween the request to actually start processing something. Looks like after less than 30 minutes (I have no more data right now, could be 5 min or more) the functions goes into idle mode. It makes the service not recommended for some scenarios without additional work (warmup systems) but there is no info about this limitation.
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-webjobs-sdk-script#298" to the Nodejs reference topic.
This also occur when scaling, all new server are added to "load balancer" cold, making very long requests. I'm currently doing some tests and a request under no load takes < 200ms for first byte.
During our tests the functions app slows down to a creep and is basically not responding for 20-50 seconds.
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
The otherwise solution is one Function per one Function app
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 @mikezks suggestion to use a time trigger function works like a charm for now. Let's see the bill at the end of the month :-p
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: https://github.com/Azure/azure-functions-host/issues/298#issuecomment-281779696 but a bit more elaborate. We are also webpacking our non-http functions too.
Maybe also look at func pack, https://github.com/Azure/azure-functions-host/issues/298#issuecomment-307161096
Edit: Since you didn't state it, if you're on C#, the relative issue for that is here: https://github.com/Azure/azure-functions-host/issues/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,