You can create a custom target tracking scaling rule based on your business requirements. When creating a custom target tracking scaling rule, you can use a formula to combine multiple Hybrid Cloud Monitoring metrics into the rule.
Solution overview
Benefits
Support for formula operations. You can use formula operations to combine up to three metrics in a target tracking scaling rule, which allows you to manage scaling operations in a more flexible manner.
Support for more metrics. Compared with the built-in target tracking scaling rules, custom target tracking scaling rules are integrated with Hybrid Cloud Monitoring. This allows you to use additional metrics to perform scaling operations. For information about Hybrid Cloud Monitoring, see Overview.
Usage process
The solution described in this topic is developed based on the target tracking scaling rule feature of Auto Scaling and Hybrid Cloud Monitoring. You can refer to the following process to create a custom target tracking scaling rule:
Design a target tracking scaling solution.
Determine the Hybrid Cloud Monitoring metrics that meet your business requirements, and develop a target tracking scaling solution.
Execute the target tracking scaling solution.
Prepare the required Hybrid Cloud Monitoring metrics and create a target tracking scaling rule based on the metrics to execute the solution.
Constantly monitor scaling events and adjust the solution based on the monitoring findings.
Constantly monitor scaling events in your scaling group and track metric changes to improve the scaling solution.
1. Design a target tracking scaling solution
Determine the Hybrid Cloud Monitoring metrics that meet your business requirements, and develop a target tracking scaling solution. When you design your scaling solution, you can refer to the following example:
Appendix 1: Metrics describes all the supported Hybrid Cloud Monitoring metrics. To ensure the response speed of target tracking, we recommend that you select metrics with a minimum statistical period of 60 seconds.
To ensure smooth scaling operations, you must adjust the calculation for metric values based on the number of instances in the scaling group. A scale-out operation occurs when the actual metric values exceed the target metric values. A scale-in operation occurs when the actual metric values fall below the target metric values.
2. Execute the target tracking scaling solution
2.1 Prepare the required Hybrid Cloud Monitoring metrics
If you already prepared the required Hybrid Cloud Monitoring metrics, you can skip this step.
Before you perform the subsequent operations, make sure that Hybrid Cloud Monitoring is activated. For more information, see Activate Hybrid Cloud Monitoring.
Before you create a target tracking scaling rule, you must create metrics that you want to associate with the rule in the Hybrid Cloud Monitoring console for subsequent use. To create metrics, perform the following steps:
Create a namespace.
For more information, see Create a namespace.
Add metrics to the namespace.
You can add metrics to the namespace created in Step 1. For information about how to add metrics to a namespace, see Manage metric import tasks.
NoteTo ensure the response speed of target tracking, we recommend that you select metrics with a minimum statistical period of 60 seconds.
2.2 Create a target tracking scaling rule
To create a custom target tracking scaling rule in the Auto Scaling console, perform the following steps:
Before you proceed, make sure that a scaling group is created. For information about how to create a scaling group, see Create a scaling group of the ECS type or Create a scaling group of the Elastic Container Instance type.
You can execute a target tracking scaling rule to decrease the number of instances in a scaling group to 0. Before you create a target tracking scaling rule, configure the Minimum Number of Instances and Maximum Number of Instances parameters based on your business requirements. To prevent service downtime or excessive spending caused by the solution, carefully control the scaling boundaries.
Go to the Create Scaling Rule dialog box.
Configure the parameters displayed in the Create Scaling Rule dialog box based on your business requirements.
Parameter
Description
Rule Type
The type of the scaling rule that you want to create. In this example, Target Tracking Scaling Rule is selected.
Metric Type
Hybrid Cloud Monitoring
Monitor Namespace
The namespace of the metrics that you want to specify in the scaling rule. In this example, the namespace created in Step 2.1 is selected.
Metric Description
The metrics that you want to specify in the scaling rule and the monitored resources. In this example, the metrics prepared in Step 2.1 are selected.
Metric Calculation Expression
The formula based on which the metric values are calculated. You can specify
+ - * /
and()
in each formula.ImportantYou can specify up to three metrics in each formula.
To ensure smooth scaling operations, you must adjust the calculation for metric values based on the number of instances in the scaling group. A scale-out operation occurs when the actual metric values exceed the target metric values. A scale-in operation occurs when the actual metric values fall below the target metric values.
Target Value
The target value of the metrics. Auto Scaling ensures that the values of the specified metrics remain close to the target value.
Instance Warmup Time
The period of time during which instances are in the Warmup state. Unit: seconds. Auto Scaling adds instances in the Warmup state to a scaling group, but does not report the monitoring data of the instances to Hybrid Cloud Monitoring. When Auto Scaling calculates the number of instances to scale based on the monitoring findings, Auto Scaling does not include instances in the Warmup state in the count of existing instances in the scaling group. This helps prevent metric values from fluctuating until the warmup period ends.
Threshold for Scale-out Alerts
After a target tracking scaling rule is created, an event-triggered task is automatically created. This parameter specifies the number of consecutive times that the alert condition must be met before a scale-out operation is initiated by the event-triggered task.
Threshold for Scale-in Alerts
After a target tracking scaling rule is created, an event-triggered task is automatically created. This parameter specifies the number of consecutive times that the alert condition must be met before a scale-in operation is initiated by the event-triggered task.
Disable Scale-in
Specifies whether to disable scale-in operations. This feature affects the number of event-triggered tasks that are automatically created.
If you enable the Disable Scale-in feature, Auto Scaling creates only one event-triggered task for the scale-out operation. In this case, Auto Scaling does not remove instances from the scaling group.
If you disable the Disable Scale-in feature, Auto Scaling creates one event-triggered task for the scale-out and scale-in operations, respectively.
After you complete the configuration, click OK.
3. Constantly monitor scaling events and adjust the solution based on the monitoring findings
After you create the target tracking scaling rule, you must regularly monitor the scaling group to ensure the desired result is achieved. To assess the success of the scaling group, you can analyze metric calculations, scaling activities, and monitoring findings.
Related operations
View the target tracking scaling rule
Choose
. On the page that appears, find the target tracking scaling rule you want to view. Then, click the corresponding ID to go to the rule details page. You can also click the event-triggered task associated with the rule to view the monitoring information about the task.View metric calculations
After you create a target tracking scaling rule, two event-triggered tasks are automatically created. Choose
. On the page that appears, find the desired event-triggered task and click the ID to go to the task details page. Then, view the metric calculations.View scaling activities
On the
tab of the scaling group details page, view the logs of scaling activities that occurred in the scaling group.