Search code examples
azureazure-functionscold-start

Azure Functions - Consumption plan & Cold starts


I have an Azure Function App, and sometimes, I notice that the function API (HTTP triggered) takes longer to respond. I believe this is due to cold starts.

Within my Function App, I have a function, which is a timer, that is triggered every minute.

Given that the Function App is active every minute, shouldn't cold starts be avoided on my Function App?

Thanks.


Solution

  • When using the consumption plan, container resources are deallocated after roughly 20 minutes of inactivity, meaning that the next invocation will result in a cold start - source. So you shouldn't have sequential cold starts if you're triggering the same function app every minute.

    Additionally, cold starts can still occur due to auto-scaling to handle capacity when creating a new container instance.

    If you choose the premium plan, function apps will run continuously, or nearly continuously, avoiding cold starts with perpetually warm instances.