Whenever someone starts architecting Azure Infrastructure they jump on Virtual Machines and start provisioning workloads for Azure VM.
I must tell you before you plan your Virtual Machines in Azure, you must plan a couple of things such as Virtual Network, Availability Set,Managed Disks, Desired State Configuration, Deploytment appproach, Regional and High availability set, load balancers and trafic managers, Application Getway, VPN and express routes and so many things...
In this article I will talk about a very small but very important concept : Availabilty Set with Fault Domains and Update Domains.
- Availability Sets ensure that the Azure virtual machines are deployed across multiple isolated hardware nodes in a cluster.
- By deploying your vms across multiple hardware nodes Azure ensures that if hardware or software failure happens within Azure, only a sub-set of your virtual machines are impacted and your overall solution is safe and in working condition.
- Availability set provides redundancy for your virtual machines.
- Availability set spreads your virtual machines across multiple fault domains and update domains.
- If you want to leverage Microsoft’s 99.95% SLA from Microsoft you must place your VMs inside availability set except your VMs are having premium storage.
Following are the 3 main scenarios which can cause your vms in Azure to be impacted or make them in a faulted state.
- Unplanned Hardware Maintainance Events - When Azure platform predicts that the hardware or any platform components associated to a physical machine is about to fail.
- An unexpected downtime -- rarely occurs
- Planned Maintenance events -- periodic updates made by Microsfot.
After both planned and unplanned updates your virtual machines and your operating system will be rebooted.
Each virtual machine in the Availability Set is assigned an Update domain and Fault domain by the Azure platform.
- Fault domains define the group of virtual machines that share a common power source and network switch.
- Each and every fault domain contains some racks and each rack contains virtual machine.
- Each of these Fault domain shares a power supply and a network switch.
- If there is a failure in the fault domain then all the resources in the fault domain become unavailable.
- You should place your vms such a way that each fault domain get one web server, one database server and like that.
Consider a below mentioned diagram.
Here we have arranged web server vm and database server vm in such a way that if one Fault Domain fails, still your vms would be available.
Update Domains
- Virtual machines get update domains automatically once they are put inside availability set.
- All virtual machines within that update domain will reboot together.
- Update domains are used for patching of the virtual machines.
- Only one update domain would be updated at the time
How many Fault Domains and How many Update Domains we can have?
- In Azure Service Management (ASM) portal, we have two Fault domains and 5 update domains.
- In Azure Resource Manager(ARM) portal, we have three Fault domains and 5 update domains but we can upgrade our update domains from 5 to 20.
- VMs are assigned sequentially in the update domains and fault domains.
- Consider the below mentioned table to understand how virtual machines would be placed within Fault Domains and Update Domains inside an availability set.
Virtual Machines | Fault Domain (3 Fault doamins) | Update Domain (5 Update domains) |
VM 1 | 0 | 0 |
VM 2 | 1 | 1 |
VM 3 | 2 | 2 |
VM 4 | 0 | 3 |
VM 5 | 1 | 4 |
Key Points to remember
- You need to create virtual machines in the same resource group as the availability set.
- One virtual machine can only be in one availability set.
- You can assign virtual machines to the availability set only during the creation of virtual machines.
- You should create separate storage accounts for each virtual machine.