Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

Scaling VMs in IaaS in Azure

0.00/5 (No votes)
18 Nov 2018CPOL5 min read 6.6K  
Exploring Azure ScaleSet VMs

Introduction

An Azure Scale Set is built from VMs, a set of identical VMs. An Azure Scale Set can contain up to 100 VMs. With Scale Sets the automation and management layers needed to run and scale your applications are provided by Microsoft. It’s also possible to manually create and manage VMs, however, scale sets have a number of advantages compared to setting VMs up manually.

Image 1

VMs are a part of Azure’s Infrastructure as a Service (IaaS). Basically, this means that Microsoft will run VMs of your choosing in Azure while they provide you with access to the VMs. One of the most important features of the public cloud, such as Azure, is its scalability. If you need to scale up operations to run an application for a period of time, you can create VMs in Azure, run the application there and when you’re done turn it off again.

In Azure you create VMs by using templates, you don’t get to customise the details of how much CPU and memory you want, but the templates do come in different sizes. It’s important to choose the correct size for your needs as you don’t want to have to pay more for a VM that is too large. In Azure, it’s pay-as-you-go so it’s very important to completely remove your VM when you’re done with it. If you don’t do this, you can still get charged. This is because even though you may not be using the VM, you’re still reserving the hardware space from Microsoft.

Scale sets

An Azure Scale Set is built from VMs, a set of identical VMs. An Azure Scale Set can contain up to 100 VMs. With Scale Sets the automation and management layers needed to run and scale your applications are provided by Microsoft. It’s also possible to manually create and manage VMs, however, scale sets have a number of advantages compared to setting VMs up manually. The advantages are as follows-

Image 2

Using scale sets means that you can provide high availability to your applications and they also allow you to manage, configure and update a large number of VMs at one time. The first VM is the one that you customize, but all the others in the Scale Set will be identical copies of it. If there are many VMs running your application then it’s important that the configuration be consistent; for example, disk configuration, application installs and VM size should all be the same.

Image 3

 

You can define the scale set in Azure in a number of different ways, including:

 

- Using Azure portal to create both Linux and Windows
- Through PowerShell or Azure command-line tools
- Through Azure Resource Manager (ARM)

 

Your definition will tell Azure the name of the scale set, how many VMs will be in it, what size VM instance you want to use, among other information. It’s possible to customize the VM which will be used by your scale set by creating a customized image which you supply to Azure, or by using a prebuilt image and installing your application when the scale set is started, or by customizing the image to include container software and then loading the application container.

 

Because all the VMs in a scale set are identical, you only have to configure the instance once.

 

 

When you start the Scale Set, Azure will create infrastructure for you including network addresses and load balancers. This infrastructure is shared between all the Scale Set VMs and is contained in the Azure resource group you specify. Once these objects have been created, the system will start creating VM instances up to the limit you set in your definition.

 

Once the Scale Set is created, then you have to be able access it. There are several options to do this including:

  • Giving each VM in the set its own public IP address. This is a more expensive and more complex option.
  • Using a load balancer with NAT, probably setting each instance in the scale set to use a different TCP port.
  • For outgoing traffic, setting up one machine with a public IP, then connecting to it and using it as a launching point to connect the other VMs with private IP addresses.
  • For incoming traffic, setting up an Azure Application Gateway or load balancer and using it distribute incoming traffic.

Auto-scaling

An Azure Scale Set can also autoscale. This means that VMs will be added or removed by Azure depending on whatever parameters you’ve set, if you’ve enabled autoscale. This allows you to add resources to deal with increases in load or remove resources that are not being used. You should scale between a minimum and a maximum number of instances. Setting a maximum, limits your total possible hourly cost. If you don’t enable autoscale, then you can add or remove instances of your VM through the Azure portal or with Azure PowerShell.

Image 4

Autoscaling can happen depending on demand or according to a schedule. You also need to define the trigger – action rules based on resource consumption to trigger the autoscale. When a Scale Set autoscales a matching load balancer NAT rule is generated. This ensures that the VMs always have a connection path. Inbound connectivity is thus controlled making a scale set VM more secure than a standalone VM.

Autoscale has the following supported services as of November 2018-

Image 5

Autoscale only scales horizontally, which means that it increases the number of instances of a VM. If you want to scale vertically (increase the power of the instances), then it’s generally necessary to stop and restart the VMs.

 

History

Version 1 - 18/Nov/2018

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)