Skip to content

Limit Azure function instance scale out with app service plan set to manual scale out #9447

Closed
@Tanuja0049

Description

@Tanuja0049

Is your question related to a specific version? If so, please specify: azure function version 2

What language does your question apply to? (e.g. C#, JavaScript, Java, All) function is written in C#, .net 7 isolated

Question

We have a service bus queue triggered function which makes external API calls to get data. This function is supposed make multiple API calls depending on the input. 1 function execution can take up to 2 hours to process, so we have moved the function to app service plan. Currently the app service plan scale out method is set to Manual with instance count of 2.

Our API has rate limit, so we cannot execute multiple queue messages at same time. Currently if we add 2 messages in queue, two instances of function app are picking those and processing parallely.

The service bus configurations in host.json are as below:
"serviceBus": {
"prefetchCount": 1,
"messageHandlerOptions": {
"maxConcurrentCalls": 1,
"maxAutoRenewDuration": "24:00:00"
}
}

I have tried below app settings but they don't have any impact:
WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT = 1
FUNCTIONS_WORKER_PROCESS_COUNT = 1

I have also tried Singleton attribute on function as below:
[Singleton(Mode = SingletonMode.Listener)]

This also shows no impact on concurrent executions.

my question is, how we can limit the scale out for a specific function to 1 even if the app service plan is set to 2? This needs to be modified at function app level. Is this possible with app service plan if scale out is manual?

If not, which is better approach?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions