The target tracking scaling feature is the result of deep integration of Auto Scaling and CloudMonitor. You can use this feature to define scaling policies in a more reliable, precise, and fast manner. If you encounter unexpected issues when you run your business, such as sudden increase of access traffic and hardware failures, you can create target tracking scaling rules to quickly trigger auto scaling and ensure system reliability and availability.
Description
Target tracking scaling rules are a new type of scaling rules that are developed based on simple scaling rules. When you create a target tracking scaling rule, you must specify a CloudMonitor metric and a target value for the metric. Then, Auto Scaling calculates the required number of instances and scales instances based on the calculated result to keep the CloudMonitor metric value close to the target value.
Auto Scaling supports step scaling rules, predictive scaling rules, simple scaling rules, and target tracking scaling rules. For more information, see Overview of scaling rules.
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.
You must make sure that the metrics you want to use meet the preceding requirements. The following table describes the metrics that are supported by target tracking scaling rules in scaling groups of different types.
Scaling groups of the ECS type
API-based metric
Console-based metric
CpuUtilization
(ECS) Average CPU Utilization
IntranetRx
(ECS) Average Inbound Internal Traffic
IntranetTx
(ECS) Average Outbound Internal Traffic
ClassicInternetRx/VpcInternetRx
(ECS) Average Inbound Public Traffic
NoteIf 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 a virtual private cloud (VPC).
ClassicInternetTx/VpcInternetTx
(ECS) Average Outbound Public Traffic
NoteIf 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 to the Internet over the classic network.
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 to the Internet over a VPC.
MemoryUtilization
(Agent) Memory
The memory usage collected by the CloudMonitor client.
LoadBalancerRealServerAverageQps
(ALB) QPS per Backend Server
NoteIf you select this metric for Metric Type, you must also configure ALB Server Group.
Scaling groups of the Elastic Container Instance type
API-based metric
Console-based metric
EciPodCpuUtilization
CPU Utilization
EciPodMemoryUtilization
Memory
LoadBalancerRealServerAverageQps
(ALB) QPS per Backend Server
NoteIf you select this metric for Metric Type, you must also configure ALB Server Group.
Features
Disable Scale-in: If you do not want to remove instances from your scaling group after a target tracking scaling rule is executed, you can turn on Disable Scale-in.
To disable scale-in, you can go to the Create Scaling Rule dialog box in the Auto Scaling console and turn on next to Disable Scale-in. You can also set DisableScaleIn to true when you call the CreateScalingRule operation to disable scale-in.
After you turn on Disable Scale-in, an event-triggered task for scale-out is created. No event-triggered task for scale-in 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 and an event-triggered task for scale-in 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, Auto Scaling does not collect metric statistics of the instance.
An instance that is newly added to a scaling group can contribute to the specified metric that is 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 the warmup time based on your business requirements. During the warmup time, Auto Scaling rejects the requests to execute scaling rules in the scaling group.
Before you configure Instance Warmup Time, 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 metric data of the instance is not counted toward the aggregated metric data of the scaling group. CloudMonitor does not consider the instance that is being warmed 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. Then, CloudMonitor considers the instance as a part of the capacity of the scaling group.
Instances that are being warmed up in a scaling group cannot be counted as the base for scale-outs.
For example, you have a scaling group that contains two instances, and a scale-out 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 before the instance warmup time expires.
During a scale-in, Auto Scaling sets an appropriate default cooldown time to prevent instances that are being warmed up from being removed from the scaling group due to continuous scale-ins caused by data latency.
Comparison between the target tracking scaling rule and the simple scaling rule
The following table describes the differences between the target tracking scaling rule and the simple scaling rule.
Item | Simple rule | Target tracking scaling rule |
User engagement | High user engagement. You can create custom scaling rules based on your business requirements to scale instances on demand. However, you must keep yourself updated on specific scaling activities and target values. | Low user engagement. The combination of scaling methods and scaling time allows you to focus only on the target metric value. |
Adjustment granularity | Fixed adjustment. You can create simple scaling rules to trigger scale-ins or scale outs. 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 keeps 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 | Less control over the adjustment process.
| Flexible control over the adjustment process.
|
Create a target tracking scaling rule
Precautions
Before you create a target tracking rule, take note of the following items:
You cannot specify a metric for more than one target tracking scaling rule.
When you create a target tracking rule, two event-triggered tasks are automatically created.
You cannot modify or delete the event-triggered tasks. You can only view, disable, and enable the event-triggered tasks. If you want to delete the event-triggered tasks, delete the corresponding target tracking rule.
One event-triggered task uses a conservative scale-in policy. The other event-triggered task uses a progressive scale-out policy.
For example, if the event-triggered task that uses the progressive scale-out policy collects metric data every 60 seconds, a scale-out is triggered after the threshold for scale-out is reached for three consecutive minutes. If the event-triggered task that uses the conservative scale-in policy collects metric data every 60 seconds, a scale-in is triggered after the threshold for scale-in is reached for 15 consecutive minutes.
If an event-triggered task 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 in the event-triggered task. For a scale-out, the required number of instances rounds up to prevent instance shortage even after the scale-out. For a scale-in, the required number of instances rounds down to prevent too many 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.
No scaling activity is triggered in the scaling group if the metric data does not reach the threshold.
If the scaling group contains a small number of instances, you may 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 is triggered.
Procedure
You can create a target tracking scaling rule for a scaling group by using the Auto Scaling console or calling an API operation.
Console: Find the scaling group in which you want to create a target tracking scaling rule and create the rule. For more information about how to create a target tracking scaling rule, see Manage scaling rules.
API: Call the CreateScalingRule operation to create a target tracking scaling rule. For more information, see CreateScalingRule.