The purpose of a scaling rule varies based on its type. A scaling rule can be used 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.
|Step scaling rule||Triggers a scaling activity.||A step scaling rule allows you to specify more than one step adjustment. In each step adjustment, the instances in the scaling group are automatically scaled based on the alerts that are reported by CloudMonitor. The difference between a step scaling rule and a simple scaling rule is that you can specify one or more step adjustments by using a step scaling rule while you can specify only one scaling adjustment by using a simple scaling rule.|
|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. The predictive scaling rule incorporates the machine learning technology to find the 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 not meet your business requirements. The 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 problems:
|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.
Note After you create a target tracking scaling rule for the scaling group, Auto Scaling automatically creates an event-triggered task and associates this 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 need the event-triggered task, you must delete the associated target tracking scaling rule. After you delete the associated rule, Auto Scaling automatically deletes the event-triggered task.
|Simple scaling rule||Triggers a scaling activity.||A simple scaling rule allows you to add or remove a specified number of instances or set the number of instances to a specific value.|
When you create a predictive scaling rule, take note of the following items:
- A predictive scaling rule requires at least 24 hours of metric history 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 one 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 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.
Scaling rules are subject to the following limits:
- You can create only a limited number of scaling rules for a scaling group. For more information, see Limits.
- If the number of instances that are in the In Service state is greater than the maximum
number of instances allowed or less than the minimum number of instances allowed after
a scaling rule is executed, Auto Scaling automatically adjusts the number of instances
to keep the number within the expected range. Examples:
- You have a scaling group named asg-bp19ik2u5w7esjcu**** that can contain up to three instances. One of its 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 the add3 scaling rule is executed, 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 its 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 the reduce2 scaling rule is executed, only one instance is removed from the scaling group.
- If you have overdue payments within your account, no scaling rules can be executed.
Notice To use Auto Scaling, make sure that you have sufficient balance within your account.
Operations that can be performed on scaling rules
The following table describes the operations that you can perform on scaling rules in different scenarios.
|If you want Auto Scaling to automatically trigger scaling activities or adjust the maximum and minimum numbers of instances for your scaling group, you can create different types of scaling rules in the Auto Scaling console.|
|A scaling activity is immediately triggered after a scaling rule is executed. If you want to obtain information about the scaling activity that is triggered in your scaling group at the earliest opportunity, you can view the details of the scaling activity in the Auto Scaling console.|
|If your scaling rule no longer meets your business requirements, you can simply modify one or more parameter settings of the scaling rule. You do not need to create a new scaling rule.||Modify a scaling rule|
|If you no longer need a scaling rule, you can delete the scaling rule to free up the quota.||Delete a scaling rule|
|When you execute a predictive scaling rule, you can check whether the predictions that are generated by the rule meet your expectations before you make adjustments.||View the prediction effect of a predictive scaling rule|