How can I pre-warm a Python azure function or set up pre-warmed instances?

55 Views Asked by At

We have Python Azure httpTrigger functions that have a cold start problem when we scale out. The response time spikes to 10-40s after creating a new instance for scale out. I found 2 possible solutions for this:

It looks like prewarmed instances can be set with something like preWarmedInstanceCount=n but I'm not sure if this is applicable for the Premium P3V3 plan we're on. And can I just set that in the function app environment settings, or have to do it via CLI like in the docs?

On the warmupTrigger, I added it as another function within the function app, but it's not firing.

Is there some other option for having scale-out instances wait to take requests until the function code is fully loaded and ready?

1

There are 1 best solutions below

3
Anupam Chand On

P3V3 is the premium tier of app service. You are just running function on that app service. EP1/2/3 are premium versions of azure functions which have in built elasticity.

I you look at this documentation here, it talks of a preview automatic scaling functionality and it says that you set the prewarmed instances but only via CLI and not by the portal. So you can't set this through any Function configuration...yet.