Pure.Krome
Pure.Krome

Reputation: 87087

Only have one instance of an Azure Function?

I can't find any documentation on how to force an Azure Function v4 into a singleton, so as the function app scales out (for reasons), one of the functions doesn't scale out.

My function is a TIMER TRIGGER, in a v4 .NET6.0 ISOLATED Azure function.

Upvotes: 1

Views: 5124

Answers (2)

NotFound
NotFound

Reputation: 6272

Even if your Function App scales out the timer trigger will only run on a single instance.

If a function app scales out to multiple instances, only a single instance of a timer-triggered function is run across all instances. It will not trigger again if there is an outstanding invocation is still running.

Microsoft docs

edit new quote:

The timer trigger uses a storage lock to ensure that there is only one timer instance when a function app scales out to multiple instances. If two function apps share the same identifying configuration and each uses a timer trigger, only one timer runs.

edit newer quote:

If a function app scales out to multiple instances, only a single instance of a timer-triggered function is run across all instances. It will not trigger again if there is an outstanding invocation is still running.

Upvotes: 7

anon
anon

Reputation:

This MS doc shows direct creation of .net 6 in Azure functions v4 in Visual Studio and this is for working with VS code to the same .Net 6 Azure Functions V4 and this MS doc helps you to work with Azure Functions v4 and .Net Core 6 through the command line.

I can't find any documentation on how to force an Azure Function v4 into a singleton, so as the function app scales out (for reasons), one of the functions doesn't scale out.

If a function app scales out to multiple instances, only a single instance of a timer-triggered function is run across all instances. It will not trigger again if there is an outstanding invocation is still running.

Please refer this MSFT documentation for more details and this GitHub thread.

Upvotes: 1

Related Questions