Azure VM Scale Sets is a service that provides a set of load-balanced VMs in the Azure cloud. All VMs in a set are created using a single configuration definition and are treated as a single logical unit. Additionally, VM Scale Sets is a technology underneath Microsoft’s Azure Service Fabric and Azure Batch. Azure VM Scale Sets are often referred to as the successor to the legacy Classic Azure Cloud Services (Web/Worker cloud roles)
Netreo provides monitoring, automation and auto-scaling capabilities for Azure VM Scale Sets, you can learn more about it here. In this article, we’ll describe how to automatically scale VM Scale Sets based on CPU and memory utilization. The same approach can be applied to auto-scaling based on ASB queue or topic depths, and other performance indicators.
1. Run Netreo Setup Wizard to connect to an Azure environment
2. Modify and enable automation rules to auto-scale Azure VM Scale Sets
Netreo can automatically add and remove VM instances within a Scale Set based on user-defined conditions.
Netreo defines two auto-scaling rules in the default template for monitoring Azure Windows VM Scale Sets based on CPU utilization:
- “Scale Down (CPU)” which removes 1 instance when 30-minute average CPU utilization across all instances has been under 20% for 10 minutes sustained.
- “Scale Up (CPU)” which adds 1 instance when 30-minute CPU utilization average across all instances within monitored VMSS exceeds 70%.
These auto-scaling rules are disabled by default, they must be explicitly enabled to become active.
In this example, we’ll modify the default rules so the VMSS are also scaled up when the memory utilization exceeds 70 % and scaled down when the memory utilization drops below 20%:
- Open Configuration dialog for the Azure SQL Database resource
- In the “Scale Adjustments” tab open “Scale up (CPU)” action definition. Tick the “Enabled” checkbox, and modify the condition to add instances if either CPU or memory utilization exceeds 70 % (screenshot below).
- In the “Scale Adjustments” tab open “Scale down (CPU)” action definition. Tick the “Enabled” checkbox, and modify the condition to only remove instances if both CPU and memory utilization drop below 20 % (screenshot below).
3. Activate an overall scaling limit
It may be beneficial to ensure that the number of instances in a Scale Set never exceeds or drops below certain thresholds. This can be done by defining Scale Ranges.
Netreo includes an Overall Scaling Limit rule in the default monitoring templates for Scale Sets, which ensures there are never less than 3 VM instances in the set. The rule must be explicitly enabled to become active:
- In the “Scale Ranges” tab open the “Overall Scaling Limit” rule editor.
- Tick the “Enabled” checkbox.
Netreo can also auto-scale Azure VM Scale Sets based on other signals captured anywhere in your Azure environment, for example, based on queue lengths. Read this article to learn more.