Reputation: 2574
I need to have only one instance of an Azure Function App in place and put the following json code in host.json
.
But when a function gets triggered by a servicebus queue
, I can clearly see in Live Metrics Stream
in Application Insights that several servers get provisioned to serve the load. What am I missing to limit the running servers to only one?
{
"version": "2.0",
"WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT": 1,
"maxConcurrentCalls": 2,
"extensions": {
"serviceBus": {
"prefetchCount": 1,
"messageHandlerOptions": {
"maxConcurrentCalls": 2
}
}
}
}
Upvotes: 1
Views: 3098
Reputation: 2970
Why do you want to do that? Remember that each instance can process multiple messages at the same time, so 1 instance does not means one message at at time
Anyways, you can go to your app settings and add the following:
WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT = 1
Upvotes: 4
Reputation: 4384
WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT
is an application setting, not a host.json
setting. I would also point out that it's somewhat less than 100% reliable, so if you need a hard guarantee of only 1 instance then you should use either a Premium plan or a standard App Service plan rather than a Consumption plan.
Upvotes: 1