Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.93k stars 440 forks source link

Timer function BCDR and reusing the same hostId #9452

Open dxynnez opened 1 year ago

dxynnez commented 1 year ago

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

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

c#

Question

Since Azure function doesn't support regional failover, we have to deploy the same functions to function apps in multiple regions, to support BCDR with an active-active model.

One challenge we are facing is how to guarantee the single instance of timer function. We were thinking to have all the function apps to reuse the same AzureWebJobsStorage and the same AzureFunctionsWebHost__hostid, so all timers would effectively share the same storage lock and still guarantee the singleton behavior.

But according to https://learn.microsoft.com/en-us/azure/azure-functions/storage-considerations?tabs=azure-cli#host-id-considerations, in v4 multiple function apps sharing the same storage account & hostid would result in a hard failure for the function host. Is this true?

We have a function app in v4 with both slots (staging & production) sharing the same storage account & hostid but they seem to be working. What are the side-effects / special considerations for doing so? We are under the expectation that sharing the same storage account & hostid is effectively scaling the function app out to multiple instances.

We have reviewed the https://learn.microsoft.com/en-us/azure/azure-functions/functions-geo-disaster-recovery doc and we are ok with active-passive mode for non-http trigger functions (by listening to different event sources) excepts the cosmosdb trigger (as obviously we don't want to separate the actual data store). Would there be any problem for the active-passive mode if function apps share the same storage account & hostid?

dxynnez commented 1 year ago

Hello team, can we have someone look into the question?