Virtual Machine Scalability in Azure – Part 1

You can provide automatic scalability for Azure VMs by using Azure VM scale sets. A VM scale set consists of a group of automatically provisioned Windows or Linux virtual machines that share identical configuration and deliver the same functionality to support a service or application. With a VM scale set, the number of virtual machines can increase or decrease, adjusting dynamically to changes in demand for its workload. The workload should be stateless to efficiently handle deprovisioning of VMs when scaling in. To implement autoscaling, you should leverage capabilities of the Microsoft.Insights resource provider.

VM scale sets integrate with Azure load balancers to efficiently handle dynamic distribution of network traffic across multiple virtual machines. They also support network address translation (NAT) rules, allowing for connectivity to individual virtual machines in the same scale set. VMs in the same scale set are automatically distributed across five fault domains and five update domains.

From a storage perspective, you can configure VM scale sets with both managed and unmanaged disks. Using managed disks offers additional scalability benefits. In particular, with managed disks, when using an Azure Marketplace image to provision a VM scale set, you can scale out up to 1000 VMs. With unmanaged disks, the upper limit is 100 VMs per scale set.

When using custom images, managed disks allow you to scale out up to 100 VMs. With unmanaged disks, you should limit your deployment to 20 VMs. You can increase this number to 40 if you set the overprovision property of the VM scale set to false. This way, you ensure that the aggregate Input/Output Operations Per Second (IOPS) of virtual disks in the VM scale set stays below the 20,000 IOPS limit of a single Standard Azure storage account.

Note: VM scale sets are available only when using the Azure Resource Manager deployment model.

This solution differs from the classic VM horizontal scaling approach, which required you to preprovision each VM that you wanted to bring online, to accommodate increased demand.

Implementing VM scale sets

To provision a VM scale set, you can use the Azure portal, Azure PowerShell, Azure Command Line-Interface (Azure CLI), or Azure Resource Manager templates. When using templates, you should reference the Microsoft.Compute/virtualMachineScaleSets resource type. This resource type implements a number of properties, including:

  • tier. The size of the virtual machines in the VM scale set.
  • capacity. The number of virtual machine instances that the scale set will auto-provision.
  • virtualMachineProfile. The disk, operating system, and network settings of the virtual machines in the scale set.

To configure Autoscale, reference the Microsoft.Insights/autoscaleSettings resource type in an Azure Resource Manager template. Some of the more relevant properties that this resource type implements include:

  • metricName. The name of the performance metric that determines whether to trigger horizontal scaling (for example, Percentage CPU).
  • metricResourceUri. The resource identifier designating the virtual machine scale set to monitor.
  • timeGrain. The frequency with which performance metrics are collected (between 1 minute and 12 hours).
  • Statistic. The method of calculating aggregate metrics from multiple virtual machines (Average, Minimum, Maximum).
  • timeWindow. Range of time for metrics calculation (between 5 minutes and 12 hours).
  • timeAggregation. The method of calculating aggregate metrics over time (Average, Minimum, Maximum, Last, Total, Count).
  • Threshold. The value that triggers the scale action. For example, if you set it to 50 when using the Percentage CPU metricName, the number of virtual machines in the set would increase when the CPU usage exceeds 50 percent (specifics would depend on other parameters, such as statistics, timeWindow, or timeAggregation).
  • Operator. The criterion that determines the method of comparing collected metrics and the threshold (Equals, NotEquals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual).
  • Direction. The type of horizontal scaling invoked as the result of reaching the threshold (increase or decrease, representing, respectively, scaling out or scaling in).
  • Value. The number of virtual machines added to or removed from the scale set (one or more).
  • Cooldown. The amount of time to wait since the most recent scaling event before the next action occurs (from 1 minute to 1 week).

To understand how Azure scale regarding the virtual machines, I recommend to watch this video from Mark Russinovich about Virtual Machine Scale Sets.

Marcos Nogueira

With more than 18 years experience in Datacenter Architectures, Marcos Nogueira is currently working as a Principal Cloud Solution Architect. He is an expert in Private and Hybrid Cloud, with a focus on Microsoft Azure, Virtualization and System Center. He has worked in several industries, including Aerospace, Transportation, Energy, Manufacturing, Financial Services, Government, Health Care, Telecoms, IT Services, and Gas & Oil in different countries and continents. Marcos was a Canadian MVP in System Center Cloud & Datacenter Managenment and he has +14 years as Microsoft Certified, with more than 100+ certifications (MCT, MCSE, and MCITP, among others). Marcos is also certified in VMware, CompTIA and ITIL v3. He assisted Microsoft in the development of workshops and special events on Private & Hybrid Cloud, Azure, System Center, Windows Server, Hyper-V and as a speaker at several Microsoft TechEd/Ignite and communities events around the world.

Leave a Reply

Your email address will not be published. Required fields are marked *