Skip to content

Deploy virtual machine scale set instances using best-effort zone balance#

Reliability · Virtual Machine Scale Sets · Rule · 2024_06 · Important

Deploy virtual machine scale set instances using the best-effort zone balance in supported regions.

Description#

Virtual machine scale sets (VMSS) scale-in/ out based on scaling rules your configured. When scaling-out (adding instances) using availability zones instances are distribution over the configured zones. However, it may not be possible to create an instance in a zone if there is an active issue affecting that zone.

The distribution behavior of instances across zones can be configured with two modes:

  • Best-effort zone balance - Attempt to scale-in/ out while maintaining balance across zones. If that is not possible, allow temporary imbalance so the scaling operation can complete.
    • On subsequent scale-out attempts, the scale set adds VMs to the zones needing more VMs to restore balance.
    • On subsequent scale-in attempts, the scale set removes VMs from zones that have more VMs than required to restore balance.
  • Strict zone balance - Only allow the scaling operation to continue if zone balanced can be maintained. If that is not possible, the scaling operation will fail.

Key points:

  • Both modes attempt to keep balance across zones but have a different approach when balance can't be maintained.
  • Scale-out typically occurs to reduce pressure on the already provisioned instances by increasing capacity.
  • If scale-out fails, the workload may become unstable due to increasing pressure.
  • Balance only applies when two or more zones are configured on the VMSS.
  • An outage or disruption in a zone may impact a higher percentage of the workload instances when the workload is not balanced.

Recommendation#

Consider using best-effort zone balancing to maintain stability of the workload under load.

Examples#

Configure with Azure template#

To set best-effort zone balance for a virtual machine scale set:

  • Set the properties.zoneBalance property to false.

For example:

Azure Template snippet
{
  "type": "Microsoft.Compute/virtualMachineScaleSets",
  "apiVersion": "2023-09-01",
  "name": "[parameters('name')]",
  "location": "[parameters('location')]",
  "sku": {
    "name": "b2ms",
    "tier": "Standard",
    "capacity": 3
  },
  "properties": {
    "zoneBalance": false
  },
  "zones": [
    "1",
    "2",
    "3"
  ]
}

Configure with Bicep#

To set best-effort zone balance for a virtual machine scale set:

  • Set the properties.zoneBalance property to false.

For example:

Azure Bicep snippet
resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2023-09-01' = {
  name: name
  location: location
  sku: {
    name: 'b2ms'
    tier: 'Standard'
    capacity: 3
  }
  properties: {
    zoneBalance: false
  }
  zones: [
    '1'
    '2'
    '3'
  ]
}

Configure with Azure Verified Modules

A pre-built module is avilable on the Azure Bicep public registry. To reference the module, please use the following syntax:

br/public:res/compute/virtual-machine-scale-set:<version>

Comments