Pragmatic
Pragmatic

Reputation: 3127

For every event, does azure create a new instance of Azure function in consumption plan

I was reading about Azure function and found out that azure only charge for the time azure function is running. Suppose I have created an Azure function and bounded it with service bus. Will Azure create a new Azure function instance for every event or will it utilized already created azure function. I am worried about performance. If it loads azure function for every event, it can be huge impact on performance.

Thanks

Upvotes: 1

Views: 1442

Answers (1)

Wah Yuen
Wah Yuen

Reputation: 1619

On a Consumption Plan, Azure Functions will utilize the existing function 'instance' that has been loaded, provided it is available.

If all functions on the Application have not received a request for processing for a given amount of time, the instance will be 'torn down' and you will have to 'warm up' for the next request that is accepted. I haven't been able to find 'official' documentation indicating the idle time, but there are multiple GitHub issues that do make reference of this idle time being 5 minutes of inactivity.

For Functions that are created under the Consumption Plan, the Function App instance will stay alive for 5 minutes

Function goes idle when running in Consumption Plan with Service Bus Queue trigger

Provided you have activity occurring regularly in at least 1 of your functions, then your app will remain in a 'warmed up' state and serve your requests immediately.

If this is not a desirable behavior, please consider a 'workaround' or potentially look at an App Service Plan with 'Always On' setting enabled. Please see similar answer here if you are interested in this.

Upvotes: 1

Related Questions