A target tracking scaling rule allows you to make fast, accurate, flexible adjustments in a scaling group. A target tracking scaling rule can simplify dynamic scaling and trigger automatic scaling of instances in a scaling group. To create a target tracking scaling rule, you must use Auto Scaling and CloudMonitor together.

Background information

Auto Scaling supports step scaling rules, predictive scaling rules, simple scaling rules, and target tracking scaling rules. For more information, see Overview. Target tracking scaling rules are the evolution of simple scaling rules. When you create a target tracking scaling rule for a scaling group, you need to select a metric that is reported to CloudMonitor and set the target value for the metric. Auto Scaling calculates the required number of instances and scales instances in the scaling group based on the difference between the number of existing instances and the number of required instances to keep the metric value at or close to the specified target value.

Metrics and features

Metrics

Not all metrics on CloudMonitor can be used to create a target tracking scaling rule. The metrics that you can configure for target tracking scaling rules must be valid utilization metrics and can describe information about the workloads of instances in a scaling group. The metric values can be increased or decreased proportionally to the number of instances in the scaling group. The following table describes the metrics that you can configure for target tracking scaling rules.

Metric (API) Metric (Console)
CpuUtilization (ECS) Average CPU Utilization
IntranetRx (ECS) Average Inbound Internal Traffic
IntranetTx (ECS) Average Outbound Internal Traffic
ClassicInternetRx/VpcInternetRx (ECS) Average Inbound Public Traffic
Note
  • If you set Network Type to Classic Network when you create a scaling group, the (ECS) Average Inbound Public Traffic metric specifies the average inbound traffic from the Internet to Elastic Compute Service (ECS) instances in the scaling group over the classic network.
  • If you set Network Type to VPC when you create a scaling group, the (ECS) Average Inbound Public Traffic metric specifies the average inbound traffic from the Internet to ECS instances in the scaling group over the virtual private cloud (VPC).
ClassicInternetTx/VpcInternetTx (ECS) Average Outbound Public Traffic
Note
  • If you set Network Type to Classic Network when you create a scaling group, the (ECS) Average Outbound Public Traffic metric specifies the average outbound traffic from ECS instances in the scaling group over the classic network to the Internet.
  • If you set Network Type to VPC when you create a scaling group, the (ECS) Average Outbound Public Traffic metric specifies the average outbound traffic from ECS instances in the scaling group over the VPC to the Internet.

Features

  • Disable Scale-in: If you do not want to remove instances from the scaling group after the target tracking scaling rule is executed, you can turn on Disable Scale-in.

    To enable the Disable Scale-in feature, you can turn on Icon next to the Disable Scale-in parameter in the Create Scaling Rule dialog box. Alternatively, you can set the request parameter DisableScaleIn to true when you call the CreateScalingRule API operation to enable the Disable Scale-in feature.

    • After you turn on Disable Scale-in, an event-triggered task for scale-out activities is created. No event-triggered task for scale-in activities is created or deleted. You can use other methods to scale in instances in your scaling group. For example, you can create an event-triggered task to monitor other metrics and execute a simple scaling rule to respond to scale-in requests.
    • After you turn off Disable Scale-in, an event-triggered task for scale-out activities and an event-triggered task for scale-in activities are created at the same time.
  • Instance Warmup Time: the period of time that is required for a newly created instance to warm up. During the warmup time, the system does not count the instance toward the aggregated metrics of the scaling group.

    An instance that is newly added to a scaling group can contribute to the specified metrics that are reported to CloudMonitor only after you deploy services, perform Server load Balancer (SLB) health checks, and collect data on the instance. When you deploy services, perform SLB health checks, and collect data on the instance, new scaling activities cannot be triggered in the scaling group. To prevent frequent scaling activities, we recommend that you configure a suitable instance warmup time. During the warmup time, Auto Scaling rejects the requests to execute scaling rules in the scaling group.

    When you configure the Instance Warmup Time parameter, take note of the following items:

    • Before the instance warmup time expires, the instance can be added to the scaling group. However, the instance does not contribute to CloudMonitor metrics. The instance is not counted toward the aggregated metric data of the scaling group. CloudMonitor does not consider the instance that is warming up as a part of the capacity of the scaling group.
    • Data on the instance is reported to CloudMonitor only after the instance warmup time expires. CloudMonitor considers the instance as a part of the capacity of the scaling group.
    • Instances that are warming up in a scaling group cannot be counted as the base for scale-out activities.

      For example, you have a scaling group that contains two instances, and a scale-out activity during which five instances are added is triggered. If you set 300 seconds for the five instances to warm up, only two instances are considered as the base for another scale-out activity before the instance warmup time expires.

    • During a scale-in activity, Auto Scaling sets an appropriate default cooldown time to prevent instances that are warming up from being removed from the scaling group due to continuous scale-in activities caused by data latency.

Precautions

When you create a target tracking scaling rule for a scaling group, take note of the following items:

  • You cannot specify a metric for more than one target tracking scaling rule.
  • You cannot delete an event-triggered task that corresponds to a target tracking scaling rule. You can only enable or disable the event-triggered task. You can also view details of the event-triggered task. If you want to delete an event-triggered task, you must delete the target tracking scaling rule that corresponds to the event-triggered task.
  • No scaling activity is triggered in the scaling group if the metric data is insufficient.
  • You can create two event-triggered tasks for the scaling group. One event-triggered task uses conservative scale-in rules. The other event-triggered task uses progressive scale-out rules.

    For example, if the event-triggered task that executes scale-out rules collects metric data every 60 seconds, a scale-out activity is triggered after the threshold for scale-out is reached for three consecutive minutes. If the event-triggered task that executes scale-in rules collects metric data every 60 seconds, a scale-in activity is triggered after the threshold for scale-in is reached for 15 consecutive minutes.

  • If an event-triggered task of the scaling group reports an alert, a scaling activity is triggered. Auto Scaling calculates the required number of instances for the scaling activity based on the monitoring history of the metric that is specified for the event-triggered task. For a scale-out activity, the required number of instances rounds up to prevent that instances that are added to the scaling group are insufficient. For a scale-in activity, the required number of instances rounds down to prevent excess instances from being removed from the scaling group.

    For example, if 1.5 instances are required to meet the scale-out requirements, 2 instances will be added to the scaling group. If 1.5 instances are required to meet the scale-in requirements, 1 instance will be removed from the scaling group.

  • If the scaling group contains a small number of instances, you might see a large difference between the metric value and the target value. The change in the number of instances has a significant impact on the aggregated metric values of the scaling group.

    For example, if the required number of instances that is calculated by Auto Scaling is less than one, alerts are continuously reported but no scale-in activities occur.

Comparison between target tracking scaling rules and simple scaling rules

The following table describes the differences between target tracking scaling rules and simple scaling rules.

Feature Simple scaling rule Target tracking scaling rule
User engagement More user engagement: You can create simple scaling rules to trigger scale-out or scale-in activities. This allows you to use instances on demand. However, you need to invest time and energy into specific scaling activities and target values. Less user engagement: Target tracking scaling rules integrate scaling methods with scaling time. You can view metric values. You only need to focus on the target value for the specified metric.
Adjustment granularity Fixed adjustment: You can create simple scaling rules to trigger scale-in or scale out activities. You cannot obtain information about the actual status of a metric. The simple scaling rules are created only based on your experience. You cannot make dynamic adjustments. Precise adjustment: When you create a target tracking scaling rule, you must specify a metric and set the target value for the metric. Auto Scaling calculates the required number of instances for scaling activities based on the monitoring history of the metric and the target value that you set for the metric. Auto Scaling attempts to keep the metric value at or close to the target value in a simplified adjustment process. This way, instances in the scaling group can be quickly and dynamically scaled in a precise manner.
Adjustment process Lack control of the adjustment process:
  • Data jitter: Simple scaling rules do not support instance warmup. The metric values of instances that are newly added to the scaling group cannot be obtained or are inaccurate. As a result, the overall metric values are inaccurate. Alerts may be triggered at inappropriate time.
  • Frequent adjustment of instance numbers: The change in the number of instances and the change in the values of the specified metric do not happen at the same time. The change in the metric value usually lags behind the change in the number of instances. In this case, alerts may still be reported, and scaling activities may be triggered due to data latency.
  • Unstable instances: If you want to keep the value of the specified metric within an expected range, you can only create a scale-out rule and a scale-in rule. If the configurations of the scaling rules conflict, the number of instances in the scaling group may frequently increase and decrease.
Flexible control of the adjustment process:
  • Stable metric data: You can configure a period of time for instances that are newly added to the scaling group to warm up. During the instance warmup period, Auto Scaling does not report the metric values of the instances to CloudMonitor. Auto Scaling also does not consider the instances that are warming up as part of the base for scaling activities. You can configure the Instance Warmup Time parameter to prevent excess instances from being added to the scaling group.
  • Infrequent adjustment of instance numbers: Auto Scaling calculates the required number of instances for scaling activities and scales instances based on the calculation to keep the value of the specified metric at or close to the target value.
  • Stable instances: Auto Scaling calculates the target value range for the specified metric based on the monitoring history.

Create a target tracking scaling rule

You can create a target tracking scaling rule for a scaling group by using the Auto Scaling console or calling an API operation.

  • For information about how to create a target tracking scaling rule by using the Auto Scaling console, see Create a scaling rule
  • For information about how to create a target tracking scaling rule by calling the CreateScalingRule API operation, see CreateScalingRule.