Using an autoscaling policy with multiple signals

When you create an autoscaling policy with multiple signals, the autoscaler scales based on the signal that provides the largest number of virtual machine (VM) instances in the managed instance group (MIG). This ensures that there are always enough VMs to handle your application workloads and lets you scale applications with multiple possible bottlenecks.

To learn more about the different types of autoscaling signals, see Autoscaling policy.

Before you begin

How autoscaler handles multiple signals

An autoscaler handles multiple signals by calculating the recommended number of VMs for each signal and then picking the signal that results in the largest number of VMs in the MIG.

An autoscaler can handle one signal per metric type except in the case of Cloud Monitoring metrics and scaling schedules. You can choose up to 5 autoscaling signals for Cloud Monitoring metrics and create up to 128 schedules per MIG. For example, you can create an autoscaler that uses up to 1 CPU utilization signal, up to 1 load balancing signal, up to 5 custom metric signals, and up to 128 scaling schedules.

For example, you can define an autoscaler with all of the following signals:

In this example, suppose the autoscaler measures the following average utilization values for a MIG that contains 10 VMs at the time of measurement:

Using the preceding values, the autoscaler calculates the recommended number of VMs based on each signal:

The autoscaler picks the signal that results in the largest number of VMs in the MIG and sets the MIG's recommended size to that value. In this case, the autoscaler resizes the MIG to 15 VMs if the second schedule is currently active or to 14 VMs otherwise.

Create an autoscaler with multiple signals

Creating an autoscaler with multiple signals is slightly different depending on whether you are using the Google Cloud console, gcloud CLI, or REST.