8
votes

I already read Understanding Serverless Cold Start | Azure App Service Team Blog article. One the the comments said You can avoid cold start in consumption plan also by calling function from Azure Logic app in every 4 mins interval.

I was trying to make 1 request per 4 minutes to one function of my app but this doesn’t always works. It sometimes still cold start. I know it's a hack. Is there any better way to ensure App always running when using Consumption plan?

2

2 Answers

11
votes

I tried to answer this question in my article Cold Starts Beyond First Request in Azure Functions.

In short, there doesn't seem to be a way to avoid cold starts completely. Keep alive calls will make the life span of a given instance longer, but it won't make it indefinitely long.

For now, Cold Starts seem to be a genuine issues of FaaS implementations, they get optimized over time, but probably you won't be able to reduce them to 0.

5
votes

According to this article, we could use Event Grid trigger to avoid cold-start delay.

Note

When you're using a blob trigger on a Consumption plan, there can be up to a 10-minute delay in processing new blobs if a function app has gone idle. After the function app is running, blobs are processed immediately. To avoid this cold-start delay, use an App Service plan with Always On enabled, or use the Event Grid trigger.

For more details to avoid cold-start delay, refer to the two articles, 1 and 2.