Which instances are stopped when I scale my Azure role down?

后端 未结 2 1308
我在风中等你
我在风中等你 2021-01-22 08:20

Suppose I have an Azure role with three instances running. I ask Azure to change the role count to two either by Management Portal or via Management API.

How will Azure

相关标签:
2条回答
  • 2021-01-22 08:42

    As British Developer mentioned, the Windows Azure Fabric Controller decides which instances to shut down. You cannot control this process. I don't think it is always the last number, because I am not sure whether the fabric controller does not rename the instances after shutting down. So even if it shuts down IN_1, at the end of the process we will still have IN_0 and IN_1, instated of IN_0 and IN_2 for example.

    You can use the RoleEnvironment.Stopping event to handle the proper stopping (clean shutdown) of your Instance. This event is being raised after the VM was taken out of Load Balancer rotation and before the OnStop Method of your RoleEntryPoint class being called.

    I am not sure where I noted, but I know that there is a hard time limit in which you have to complete your cleaning, i.e. I think the Instance will be shutdown after 5 minutes of waiting the OnStop or Stopping handler (I can't remember exactly, but the fabrci controller will not wait forever for you to clean up).

    0 讨论(0)
  • 2021-01-22 08:51

    It will usually be the last one to be spun up. So you have IN_0 IN_1 and IN_3. I've only ever see IN_3 go down when you remove one so that seems to be the one.

    However, this is not documented anywhere by Microsoft so this isn't guaranteed to be the one that goes down... just seems to be in practice.

    0 讨论(0)
提交回复
热议问题