Auto scaling

Automatic scaling of VMs in VMSS refers to the addition or removal of VM instances based on configured environments to meet the performance and scalability demands of an application. Generally, in the absence of VMSS, this is achieved using automation scripts and runbooks.

VMSS helps in this automation process with the help of configuration. Instead of writing scripts, VMSS can be configured for automated scaling up and down.

Auto scaling consists of multiple integrated components to achieve its end goal. Auto scaling continuously monitors the VMs and collects telemetry data from them. It stores this data combines it and then evaluates it against a set of rules to determine whether it should trigger the auto scale. The trigger could be to scale out or scale in. It could also be to scale up or down. 

Auto scale uses diagnostic logs for collecting telemetry data from VMs. These logs are stored in storage accounts as diagnostic metrics. Auto scale also uses the insight monitoring service that reads these metrics, combines them together, and stores them in their own storage account.

Auto scale background jobs run continually to read the insights' storage data, evaluate them based on all the rules configured for auto scaling, and execute the process of auto scaling, should any of the rules or combination of rules return positive. The rules can take into consideration metrics from guest VMs as well as the host server.

The auto scale architecture is shown in the following diagram:

Auto scale can be configured for scenarios that are more complex than general metrics available from environments. For example, scaling could be based on any of the following:

  • Scaling on a specific day
  • Scaling on a recurring schedule such as weekends
  • Scaling differently on weekdays and weekends
  • Scaling during holidays, that is, one of the events
  • Scaling on multiple resource metrics

These can be configured using the schedule property of insight resources that help in registering rules.

Architects should ensure that at least two actions—scale out and scale in—are configured together. Scaling in or scaling out configuration will not help in achieving the scaling benefits provided by VMSS.