Imagine a situation where your application has variable resource consumption nature which is mostly a case in real world. If you keep constant number of servers / resources you will have to consider higher side of traffic pattern and provision extra resources which will not efficient economically. Such unpredictable nature of applications usage is very much common and needs cost efficient solution. Virtual machine scale set feature provides this ability where in platform can add more resources automatically based on the existing resource consumption. In simple term, if your servers are running for example at 75% CPU utilization, platform can automatically add X number of VMs to sustain the load and promise consistent user experience, as soon as your resource consumption goes down additional virtual machines are removed saving cost of the ownership.
As name indicates, Virtual Machine Scale set feature can create Virtual machines for providing high availability to your application by spawning multiple identical machines instantly. This feature is also used in case your application has big compute requirements like processing big data.
Now let us discuss few frequently asked questions on scale set –
Once I have Scale set defined which can create Virtual machines dynamically, how load distribution happens between them?
Microsoft Azure has integrated load balancer which can help distribute the load.
Are Windows and Linux both types of VMs creation possible using this feature?
Yes, Windows and Linux images along with their extensions can be created using this feature. Extensions are scripts which enables / configure additional features on Virtual machine.
Does this scaling happens automatically?
Yes, VM scale set is a feature integrated with Azure Insights Autoscale which makes this automatic scaling possible.
If I have a Web application with variable resource needs, Can I use Virtual machine scale set feature?
Yes, you can use it for web front ends or services layer. You will have to plan state of application in such case so that during scale out and scale in state is not lost.
Is it necessary to use Azure Resource Manager deployment for creation of Scale set?
Yes, it works with only Azure Resource Manager model, you can create it using Portal UI or thru JSON template or REST APIs, choice is yours. There are quick start templates available here.
Do VM Sale sets work with Azure Availability sets?
Yes. A VM scale set is an implicit availability set with 5 Fault Domains and 5 Update Domains. You don’t need to configure anything explicitly for that.
Can I use my Custom VM Images for Scale set or I am limited to available platform images1 only?
Yes, you can use your Custom images but you can create VMs up to 40, this is because custom images are currently limited to single storage account. If you use platform available images1, you can create up to 100 VMs which can be distributed across multiple storage accounts.
1A platform image in this context is an operating system image from the Azure Marketplace, like Ubuntu 16.04, Windows Server 2012 R2, etc.
Is each VM in the Scale set have public IP associated with it?
A VM scale set is created inside a Virtual Network and individual VMs in the scale set are not allocated public IP addresses. To connect to these VMs or RDP it, you have multiple options like – Use other Azure resources in your Virtual network like load balancers (with public IP) or other VMs outside scale set having public IP.
Can I attach data disk to VMs in Scale set?
As of today, this feature is not available, you cannot have data disk attached. Available options are – 1. Azure files storage (SMB mounted drives) 2. Azure Storage – blob, Tables 3. OS drive 4. Temp Drive which is not backed up by Azure.
Can I install my own software or setup something while VM images are being provisioned in scale set?
Yes, you can install new software on a platform image using a VM Extension. A VM extension is software that runs when a VM is deployed. You can run any code you like at deployment time using a custom script extension.
It is advisable not to have long running script / VM extension which can delay the VM provisioning impacting applications performance. Considering creating custom image if lot of customizations are required for platform images.
What are the available options for login into VMs in Scale set?
Since each individual VM in scale does not have public IP, you cannot RDP it directly, you have following options available –
- Connect to VMs using NAT rules: You can create a public IP address, assign it to a load balancer, and define inbound NAT rules which map a port on the IP address to a port on a VM in the VM scale set.
- Create standalone VM in same Virtual network/subnet, assign it a public IP, log in to this standalone VM using RDP and then connect to individual VMs in scale set using internal IP addresses within the Virtual network. Such standalone VM is sometimes referred as “jumpbox”
Typically what types of rules can be defined for scaling out and scaling in Scale set?
Below picture shows typical rule available while configuring the scale set –
So in above example you are configuring Scale set which will have minimum 1 VM and maximum 10 it can go up to. Whenever CPU percentage reaches 75%, 1 new VM is added, as soon as it drops to 25%, 1 VM is removed from scale set.
Hope this helps in gaining basic understanding on Virtual Machine Scale Set.
Happy reading !! Thanks.