1

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.

Pexers
  • 953
  • 1
  • 7
  • 20
user8400863
  • 655
  • 1
  • 7
  • 17

1 Answers1

1

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.

Pexers
  • 953
  • 1
  • 7
  • 20
  • Ok, sometimes to get a response back from another function takes longer. My function app has multiple functions. What else could delay a http trigger? – user8400863 Oct 29 '22 at 21:17
  • I've edited my answer to add an extra scenario where cold starts can occur. If you found my answer helpful, please consider marking it as 'Accepted', thank you! :) – Pexers Oct 29 '22 at 21:37
  • So, if something is calling the azure function (*consumption plan*) every let's say 15m, theoretically container resources will never be deallocated ? (ie manually do the *Always On* feature on *premium plan*) https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#configure-general-settings . That could be a solution to benefit consumption prices and avoid cold start – bastien enjalbert Aug 05 '23 at 07:31