Scaling based on CPU utilization

The simplest form of autoscaling is to scale a managed instance group (MIG) based on the CPU utilization of its instances.

You can also autoscale a MIG based on the load balancing serving capacity, Monitoring metrics, or schedules.

Before you begin

Scaling based on CPU utilization

You can autoscale based on the average CPU utilization of a managed instance group (MIG). Using this policy tells the autoscaler to collect the CPU utilization of the instances in the group and determine whether it needs to scale. You set the target CPU utilization the autoscaler should maintain and the autoscaler works to maintain that level.

The autoscaler treats the target CPU utilization level as a fraction of the average use of all vCPUs over time in the instance group. If the average utilization of your total vCPUs exceeds the target utilization, the autoscaler adds more VM instances. If the average utilization of your total vCPUs is less than the target utilization, the autoscaler removes instances. For example, setting a 0.75 target utilization tells the autoscaler to maintain an average utilization of 75% among all vCPUs in the instance group.

You can also scale based on forecasted CPU utilization. For more information, and to see if this is suitable for your workload, see Scaling based on predictions.

Enable autoscaling based on CPU utilization

To enable autoscaling based on CPU utilization, use one of the following options. If you want to configure a stabilization period to control the pace of scaling in, then you must use either Google Cloud CLI or REST.