Virtual Machine Availability Sets in Azure
[Setting up a VM cluster within an Availability Set]
The Scope
In Azure, we can discuss Virtual Machine (VM) availability mainly in three levels within the scope of a single Azure region.
- Standalone VM — 99.9% availability (8.76 hours downtime per year)
- Availability Sets — 99.95% availability (4.38 hours downtime per year)
- Availability Zones — 99.99% availability (52.56 min downtime per year)
In this blog, I will be focusing only on “Availability Sets” and how it can help to improve availability of your cloud applications.
Availability Sets
Availability Sets make sure that the Azure VMs are deployed across multiple isolated hardware nodes in a cluster within a single Availability Zone (AZ).
If a hardware or software failure happens, only a subset of your VMs are impacted and your overall solution stays operational. Availability Sets are essential for building redundancy for your cloud solution.
Each VM in an Availability Set is assigned an Fault Domain and an Update Domain by the Azure Platform.
Fault Domains
Fault Domain defines a group of VMs that share a common power source and a network switch. If there is a failure in a fault domain, then all the resources (VMs) in the fault domain become unavailable.
If you have multiple tiers in your application, you can place your VMs such a way that each fault domain get a VM of each tier (See Figure 01).
You can have up to three (03) fault domains.
Update Domains
When a VM instance is added to an availability set, it is automatically assigned to an update domain as well. That means, each update domain can have multiple VMs.
Update domains are used for patching of VMs. Once an update domain carries out a patching process all VMs within the update domain will get rebooted. At any given point only one update domain is updated.
You can have up to twenty (20) update domains.
VM Distribution
You can have up to three (03) fault domains and twenty (20) update domains in a typical Availability set cluster.
VMs are assigned sequentially in the fault domains and update domains (See Figure 02).
Creating a VM cluster with an Availability Set
Step 1: Creating an Availability Set
Search for Availability Sets and click “New” button to create a new Availability Set. You may enter number of fault domains and update domains while creating it along with other parameters (Subscription, Resource Group, Name, Region). Pls keep Managed Disk as “Yes” as well..
Step 2: Creating a few Virtual Machines and attaching them to the created Availability Set
Now, it is time to create some VMs and assign them to the same Availability Set that you created under step 01.
Please make sure to select “Availability Set” under the “Availability Options” and select the availability set that you created. Furthermore, please make sure to choose the same Azure Region for all VMs being created.
VMs created: vm-1, vm-2, vm-3 (three VMs)
Step 3: Monitoring the Availability Set
Go to “Home” -> Select “Availability Sets” -> Select the availability set that you created under step 01.
You will see fault and update domain distribution as follows (See Figure 05).
Congratulations! you have now created a VM cluster within a single Availability Zone, which has 99.95% availability.