You can create a custom target tracking scaling rule tailored to your business needs. This rule allows you to use a formula that integrates multiple Hybrid Cloud Monitoring metrics for scaling purposes.
Solution overview
Benefits
Support for formula operations. You can combine up to three metrics in a target tracking scaling rule by using formula operations, enabling more flexible management of scaling activities.
Support for more metrics. Custom target tracking scaling rules, unlike built-in ones, integrate with Hybrid Cloud Monitoring, enabling the use of additional metrics for scaling operations. For information about Hybrid Cloud Monitoring, see Overview.
Procedure
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.
Identify the Hybrid Cloud Monitoring metrics aligned with your business needs and develop a target tracking scaling solution.
Execute the target tracking scaling solution.
Prepare the necessary Hybrid Cloud Monitoring metrics and create a target tracking scaling rule based on these metrics to implement the solution.
Continuously monitor scaling events and adjust the solution according to the insights gathered from monitoring.
Constantly monitor scaling events in your scaling group and track metric changes to improve the scaling solution.
1. Design a target tracking scaling solution
Identify the Hybrid Cloud Monitoring metrics aligned with your business needs 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 optimize target tracking response speed, we recommend that you use metrics with a statistical period of at least 60 seconds.
To ensure smooth scaling operations, adjust the calculation of metric values according to the number of instances in the scaling group. A scale-out is triggered when actual metric values exceed the target values, while a scale-in occurs when actual metric values fall below the target values.
2. Implement 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 optimize target tracking response speed, we recommend that you use metrics with a statistical period of at least 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 details page of the scaling group for which you want to create the rule.
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, adjust the calculation of metric values according to the number of instances in the scaling group. A scale-out is triggered when actual metric values exceed the target values, while a scale-in occurs when actual metric values fall below the target 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 their monitoring data to Hybrid Cloud Monitoring. When determining the number of instances to scale based on monitoring metrics, Auto Scaling excludes instances in the Warmup state from the count of existing instances in the scaling group. This prevents metric fluctuations until the warmup period concludes.
Threshold for Scale-out Alerts
When a target tracking scaling rule is created, an event-triggered task is automatically generated. This parameter defines the number of consecutive times the alert condition must be satisfied before the event-triggered task initiates a scale-out operation.
Threshold for Scale-in Alerts
When a target tracking scaling rule is created, an event-triggered task is automatically generated. This parameter defines the number of consecutive times the alert condition must be satisfied before the event-triggered task initiates a scale-in operation.
Disable Scale-in
Specifies whether to disable scale-in operations. This setting impacts the number of automatically generated event-triggered tasks.
When the Disable Scale-in feature is enabled, Auto Scaling creates only one event-triggered task for scale-out operations and does not remove instances from the scaling group.
When the Disable Scale-in feature is disabled, Auto Scaling creates separate event-triggered tasks for both scale-out and scale-in operations.
After you complete the configuration, click OK.
3. Constantly monitor scaling events and adjust the solution based on the monitoring findings
After creating the target tracking scaling rule, you must regularly monitor the scaling group to ensure the desired outcome is achieved. You can evaluate the performance of the scaling group by analyzing metrics, scaling activities, and monitoring data.
Related operation
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.
Create a target tracking scaling rule by calling an API operation
You can call the CreateScalingRule API operation to create a custom target tracking scaling rule. The following table describes the request parameters.