The purpose of a scaling rule varies based on its type. You can use a scaling rule to trigger a scaling activity or adjust the maximum and minimum numbers of instances for a scaling group. This topic describes the types and limits of scaling rules. This topic also describes the operations that you can perform on scaling rules.
Scaling rule types
The following table describes the types of scaling rules that you can create in the Auto Scaling console.
Type | Purpose | Description |
---|---|---|
Simple scaling rule | Triggers a scaling activity | You can specify the number of instances that you want to add to or remove from a scaling
group in a simple scaling rule. You can also specify the number of instances that
you want to include in a scaling group in a simple scaling rule. Compared with target
tracking scaling rules and predictive scaling rules, a simple scaling rule cannot
trigger a scale-out activity and a scale-in activity at the same time.
Note If you specify a simple scaling rule in an event-triggered task and you want to execute
the task to trigger a scaling activity, you must wait for the cooldown period to end
before you can execute the task.
|
Step scaling rule | Triggers a scaling activity | You can specify more than one step adjustment in a step scaling rule. In each step adjustment, the instances in the scaling group are automatically scaled based on the alerts that are monitored by CloudMonitor. A step scaling rule includes a set of policies that allow you to manage instance scaling in a fine-grained manner. Each step of a step scaling rule can be considered a simple scaling rule. |
Target tracking scaling rule | Triggers a scaling activity | When you create a target tracking scaling rule, you must select a CloudMonitor metric
and specify a target value. Auto Scaling automatically calculates the required number
of instances and scales instances based on the calculated number to keep the metric
value close to the target value. For more information, see Target tracking scaling rule.
Note After you create a target tracking scaling rule, Auto Scaling automatically creates
an event-triggered task and then associates the task with the target tracking scaling
rule. When the metric of the scaling group reaches the target value, the event-triggered
task is triggered to execute the associated target tracking scaling rule. If you no
longer require the event-triggered task, delete the associated target tracking scaling
rule. After you delete the associated rule, Auto Scaling automatically deletes the
event-triggered task.
|
Predictive scaling rule | Automatically adjusts the maximum and minimum numbers of instances |
A predictive scaling rule can predict the required number of instances based on at least 24 hours of historical monitoring data of your scaling group. Predictive scaling rules incorporate the machine learning technology to find patterns in the historical monitoring data and predict the metric trend for the next 48 hours. Auto Scaling uses the predicted metric trend to automatically estimate the required number of instances per hour, create scheduled tasks, and adjust the maximum and minimum numbers of instances. Prediction data is updated once a day, and 48 prediction tasks are created for the next 48 hours. If you cannot predict the required number of instances for your business, the maximum and minimum numbers of instances that you configure for your scaling group may fail to meet your business requirements. A predictive scaling rule can help you automatically adjust the maximum and minimum numbers of instances. You can create a predictive scaling rule to prevent the following issues:
|
When you create a predictive scaling rule, take note of the following items:
- A predictive scaling rule requires at least 24 hours of historical monitoring data to generate predictions.
- If you change the value of the Target Value parameter for a predictive scaling rule, the current prediction task is cleared and a new prediction task is automatically generated within 1 hour.
- A predictive scaling rule changes only the minimum and maximum numbers of instances for a scaling group. A predictive scaling rule does not scale the instances in the scaling group.
- A predictive scaling rule can be used together with other scaling rules. When you use a predictive scaling rule together with a target tracking scaling rule, we recommend that you specify the same metric and target value for both rules. Otherwise, the number of instances in the scaling group may frequently change due to the difference in the metrics.
- We recommend that you initially set Predictive Mode to Predict Only. If the predictions meet your expectations, change Predictive Mode from Predict Only to Predict and Scale. For more information, see View the prediction effect of a predictive scaling rule.
Limits
The following limits apply to scaling rules:
- You can create only a limited number of scaling rules for a scaling group. To view the quota of scaling rules, visit Quota Center.
- If the number of instances that are in the In Service state after you execute a scaling rule is greater than the allowed maximum number
of instances or less than the allowed minimum number of instances, Auto Scaling automatically
adjusts the number of instances to ensure that the number of instances is within the
allowed range. Examples:
- You have a scaling group named asg-bp19ik2u5w7esjcu**** that can contain up to three instances. One of the scaling rules named add3 adds three instances during a scaling activity. The scaling group contains two instances that are in the In Service state. If you execute the add3 scaling rule, only one instance is added to the scaling group.
- You have a scaling group named asg-bp19ik2u5w7esjcu**** that must contain at least two instances. One of the scaling rules named reduce2 removes two instances from the scaling group during a scaling activity. The scaling group contains three instances that are in the In Service state. If you execute the reduce2 scaling rule, only one instance is removed from the scaling group.
- If you have overdue payments within your Alibaba Cloud account, you cannot execute
scaling rules.
Notice To use Auto Scaling, make sure that you have sufficient balance within your Alibaba Cloud account.
Manage scaling rules
The following table describes the operations that you can perform on scaling rules and the related links.
Documentation | Operation | API reference |
---|---|---|
Manage scaling rules | Create a scaling rule. | CreateScalingRule |
Execute a scaling rule. | None | |
Modify a scaling rule. | ModifyScalingRule | |
Delete a scaling rule. | DeleteScalingRule | |
View the prediction effect of a predictive scaling rule | View the effect of a predictive scaling rule. | None |