Availability Sets work great to ensure high availability of VMs.
The article below describes the feature in detail, hope you find this useful.
Manage the availability of virtual machines
https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-manage-availability
Here are some recommendations in order to make the best use of the Availability Sets :
Note that these are ‘recommendations’ and do not affect the supportability.
- Place VMs belonging to same Application Tier in a single Availability set.
- Maintain the same VM size or family for machines in the same Availability set.
Here are the reasons behind these recommendations
Load Balancing and VM failures
The concept of Availability set focuses on the idea of having ‘replaceable’ VMs in each Application Tier.
“If your virtual machines are all nearly identical and serve the same purpose for your application, we recommend that you configure an availability set for each tier of your application. If you place two different tiers in the same availability set, all virtual machines in the same application tier can be rebooted at once. By configuring at least two virtual machines in an availability set for each tier, you guarantee that at least one virtual machine in each tier will be available.”
As described above, the idea is to have at least one VM running in case of multiple points of failure. This could be any one of the VMs in the Availability set. During normal operations, the intent is to load balance the requests among the VMs in the Availability set. In both the scenarios, it is practical and most beneficial to maintain the VMs of the same size ( or family ) to ensure equal distribution of load and least impact, and hence the recommendation.
Supportability of the VM size on the Physical Hardware cluster
All running VMs in the availability set must be using the same physical hardware cluster. This is by design.
“ If all VMs are in the same VM Size family, then you can be assured they will all be supported on the physical hardware cluster which is used to host the VMs of the availability set. “
Resize virtual machines
https://azure.microsoft.com/en-in/blog/resize-virtual-machines/
Due to this reason, we may run into Provisioning errors while Starting, Resizing or Provisioning one or more of the VMs when we try to use different size families in an Availability Set.
VM size family chart :
Refer to the table under section “Performance considerations” in the article below to get an idea of the VM size families.
https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-sizes
Managing an Availability Set with multiple VM sizes
Since the above are ideal recommendations, some administrators may still want to use multiple VM sizes in the same Availability Set. There are chances we may run into the error “Provisioning failed. Allocation failed. Please try reducing the VM size or number of VMs, retry later, or try deploying to a different Availability Set or different Azure location” while managing such setups.
Here is how we would need to perform some of the operations in such scenarios
Start Operations –
Stop all the VMs in the Availability Set. Start the one with the largest size first. This would ensure the hardware cluster allocated is compatible with the largest VM size and the ones started later ( smaller or same size ) can be hosted on the same hardware cluster.
Resize Operations –
Stop all the VMs. Resize the VMs one by one – Once again first resize the ones with the largest target size.
Refer : Resize virtual machines
https://azure.microsoft.com/en-in/blog/resize-virtual-machines/
Adding a new VM of a different size family to the Availability Set –
Stop all the VMs in the Availability set. Introduce the new VM belong to the different size family ( assuming larger one ). Then start the other VMs. We would not need these steps if the new VMs being added belongs to a smaller VM size family.
Of course, the above guidance assumes we are trying to use sizes that are supported in those regions and supported for resizing.