multiple instance to prevent single point of failure

Yang Chowmun 411 Reputation points
2021-08-20T15:52:41.653+00:00

Yesterday my azure function were crashed and I found this link about best practise to run a healthy app https://azure.github.io/AppService/2020/05/15/Robust-Apps-for-the-cloud.html#use-multiple-instances.

I have a few doubts regarding some parts of the document

  1. If we increase the number of instance, should we scale down the current app service plan. For example, I am using P2V3, after adding another instance I should scale down my plan to P1V3?
  2. I have 4 function apps, currently they are under the same app service plan. After I changed from single instance to 2 instances, can I assume that 2 function apps will be assigned to 1 instance?
  3. Is there a way to scale out automatically if the current instance is down?
  4. In the link I shared above, it mentioned that 'app code should be able to handle multiple instances without synchronization issues when reading from or writing to data sources'. After scaling out, that could be a situation where 2 same functions are running in the same time?

Thanks in advance!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,214 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,741 Reputation points
    2021-08-23T06:16:26.467+00:00

    @Yang Chowmun Please find my inline answer and let me know if you have any queries or concerns.

    If we increase the number of instance, should we scale down the current app service plan. For example, I am using P2V3, after adding another instance I should scale down my plan to P1V3?
    Its depend what the different app service offers (compute, memory etc.) in different SKU. If your load can work smothely on scalling down the app service plan and increasing the instance count then you can decrease the app service plan after testing the same load in the downgraded app service plan.

    have 4 function apps, currently they are under the same app service plan. After I changed from single instance to 2 instances, can I assume that 2 function apps will be assigned to 1 instance?
    If you run multiple function apps in a single Premium plan or dedicated (App Service) plan, these apps are all scaled together. The resources are shared among all your functions. So if you have two instance then both the instances will server all your four functions apps. You can refer to Organize functions for performance and scaling for more details.

    Is there a way to scale out automatically if the current instance is down?
    If there is any issue with any of instance then auto heal will automatically triggred and that instance will be replaced by the healthy new instance. In that scenario it is always suggested to have one or more instance so that if one instance have some issue then there should be another instance that would be still serving the request till the auto heal is completed. You can set the automatic scalling on your web app plan based on different metrics to cover this.

    In the link I shared above, it mentioned that 'app code should be able to handle multiple instances without synchronization issues when reading from or writing to data sources'. After scaling out, that could be a situation where 2 same functions are running in the same time?
    This should be same for function app but your refer to Manage connection in azure function for more details on different scenario.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.