Serving as an excellent example of Infrastructure as a Service (IaaS), Azure’s Virtual Machine Scale Sets are a powerful new approach to running VMs in the cloud. Before VM scale sets, running a set of identical virtual machines in the cloud required configuring, deploying and managing each instance individually. When the number of VMs rose into the dozens, the difficulty of the task could quickly become overwhelming. However, with the advent of VM scale sets, deploying and managing dozens, even hundreds, of identical VMs, has become almost effortless. Below we will explore how scale sets work and how you can leverage them to their fullest extent.
Deploying a template
One of the best ways to learn how to use scale sets is to visit Github’s Azure Quickstart Template repository. Simply open the scale set template that you would like to use, then click Deploy to Azure. Your browser will direct you to the Azure portal, where you can configure the template with your own parameters. You can complete the entire process in minutes.
If you prefer not to use a template, you can navigate directly to the Azure portal and click New. Perform a search for scale set, then select Virtual machine scale set from the results, which will take you to the corresponding setup page. Although most of the fields are entirely straightforward, there are a few that either require special attention or knowledge of key terminology:
When selecting a resource group, keep in mind that VM scale sets exist within, rather than across, resource groups, which can have any number of scale sets within them handling various aspects of an application.
Depending on the region and the instance-size you choose, availability zones will either be enabled or disabled automatically. If enabled, this means that your scale set will have an extra layer of protection against failure. Availability zones are thus ideal for mission-critical apps.
Enabling scaling beyond 100 instances
Azure recently announced the capacity for greatly expanded scale sets with the upper limit on the number of VMs raised to 1000. However, before choosing Yes for the option Enable scaling beyond 100 instances, see Azure’s instructions for working with large-scale sets.
Choosing a platform
When choosing a platform, note that VM scale sets will work not only with Windows and Linux images, but with your own custom image, including extensions. However, for custom VM images, the maximum number of VMs is 300, rather than 1000.
Expanding and shrinking scale sets
As an Azure administrator, you can easily increase or decrease the number of VMs in your scale set as you monitor key performance metrics. Simply expand your VM footprint during peak traffic/usage periods and contract it during off-peak traffic/usage periods, directly from the Azure portal.
Given the remarkable elasticity of scale sets, these changes can happen in just a few minutes. Furthermore, during expansions the VMs that you already have in place will not need to undergo rebooting and will continue to operate without interruption as you add additional, identical VMs to lighten the load on your existing set. In order to further improve the process, overprovisioning is turned on by default. This stabilizing process will initially load more VMs than are called for in your configuration, then reduce the number as the system reaches a stable state. There is no charge for the temporary increase in VMs.
See also the Autoscale section below.
The Azure team recommends adhering to a few key best practices when working with scale sets:
Follow Azure’s special guidelines when using large-scale sets
Small and large-scale sets place different demands on the system. For example, large-scale sets, defined as scale sets with more than 100 VMs, use more than one placement group, and require Azure managed disks. These additional demands impact the underlying dynamics significantly. Therefore, if you’re working with scale sets larger than 100 VMs, be sure to follow Azure’s guidelines for large scale sets.
Use Premium Storage
In order to provide for improved I/O performance and VM provisioning times, Azure recommends using Azure Premium Storage rather than standard Azure Storage.
Familiarize yourself with your region’s core quota
In addition to Azure’s own limits, the region in which your deployment takes place will have a core quota that places a cap on the maximum number of VMs you can have in your scale set. You can query your core quota with the following Azure CLI command:
azure vm list-usage
You may also contact Azure Customer Support to increase your core quota.
Leveraging key integrations
Azure has integrated scale sets with Autoscale, which is capable of eliminating the time-consuming task of pre-provisioning all of your VMs. Many of the Quickstart scale-set templates will already have autoscale in place. And if you’re deploying directly, you have the option of configuring your scale set with autoscale as part of your initial setup. However, if you initially choose not to take advantage of autoscale, or the template you deployed did not include it, you can always add autoscale through the portal later. Either way, autoscale allows you to automatically increase and decrease the total number of VMs in your scale set as a function of the average CPU usage. Consequently, autoscale inevitably leads to higher efficiency and fault-tolerance as the process replaces poor-performing VMs with high-performing ones. You should also expect improved availability as the app running on your scale set will not encounter the usual resource limits.
Distributing task loads across your scale set is made easy by the integration of Azure Load Balancer. Further, an integration with Application Gateway makes it possible to change network address translation (NAT) settings in order to troubleshoot specific instances in your scale set that are lagging behind.
The power of scale sets
Azure’s scale sets are a powerful new way to run VMs in the cloud. An excellent example of IaaS at its best, scale sets eliminate the need to configure, deploy and manage your VM instances individually. Without smart sets, this task quickly becomes overwhelming as the number of VMs rises into the dozens and even hundreds. Thankfully, with smart sets you can deploy as many as 1000 VMs with ease in minutes, then manage them together as a single unit.
As outlined above, you can get started with scale sets either by deploying an Azure Quickstart template or deploying directly. If you choose direct deployment, however, it’s important to familiarize yourself with resource groups, availability zones, the unique requirements of large-scale sets; and the three platform options: Windows, Linux and custom image. Once you’ve deployed your scale set, you can easily increase or decrease the number of VMs, expanding and contracting your footprint in keeping with peak and off-peak traffic/usage periods.
As you continue to hone your scale set skills, always keep the three best practices outlined above in mind: follow Azure’s guidelines for large-scale sets; use Azure Premium Storage to improve performance and provisioning times; and get to know your region’s core quota.
Finally, to get the most out of your scale sets, it’s important to fully leverage the wealth of integrations that Azure has put in place, including the integration with Autoscale, which greatly improves efficiency, fault-tolerance and availability; the integration with Azure Load Balancer, which distributes task loads evenly across your scale set; the integration with Application Gateway, which makes it possible to troubleshoot specific VMs in your scale set; and several other key integrations that complement the remarkable benefits that VM scale sets offer.
To learn more about the power of scale sets and other Azure offerings, contact us.