With target tracking scaling, you can combine multiple Hybrid Cloud Monitoring metrics in a formula to create a custom target tracking scaling rule that meets your business needs.
Overview
Benefits
Supports formulas. You can use a formula to combine up to three metrics as the tracking target for more flexibility.
Supports more monitoring metrics. This approach is based on Hybrid Cloud Monitoring. Compared with target tracking scaling rules that use system metrics, this approach allows you to use a wider range of metrics for target tracking. For more information about Hybrid Cloud Monitoring, see Overview of Hybrid Cloud Monitoring.
Workflow
This solution combines a target tracking scaling rule for a scaling group with Hybrid Cloud Monitoring. You can follow this workflow to create a custom target tracking scaling rule.
Design a target tracking scaling solution.
First, identify the Hybrid Cloud Monitoring metrics that you need and design a target tracking scaling solution based on your requirements.
Implement the scaling solution.
Prepare the required Hybrid Cloud Monitoring metrics and create a target tracking scaling rule based on these metrics.
Continuously monitor and optimize the solution.
Continuously monitor scaling activities and metric changes to optimize the solution.
1. Design a target tracking scaling solution
First, identify the required Hybrid Cloud Monitoring metrics and design a scaling solution. The following section provides an example.
For more information about the metrics supported by Hybrid Cloud Monitoring, see Appendix 1: Cloud service metrics. To ensure responsive target tracking, select metrics with a minimum aggregation period of 60 seconds.
The calculated metric value must be proportional to the number of instances in the scaling group. This ensures a scale-out occurs when the metric value is above the target and a scale-in occurs when it is below.
2. Implement the scaling solution
2.1. Prepare Hybrid Cloud Monitoring metrics
If you have the Hybrid Cloud Monitoring metrics ready, you can skip this step.
To use this feature, you must activate Hybrid Cloud Monitoring. For more information, see Activate Hybrid Cloud Monitoring.
Before you create a target tracking scaling rule, prepare the required metrics in Hybrid Cloud Monitoring. Follow these steps:
Create a namespace.
For more information, see Create a namespace.
Add the required metrics.
Based on your business requirements, add the required metrics to the namespace. For more information, see Manage metric import tasks.
NoteTo ensure responsive target tracking, select metrics with a minimum aggregation period of 60 seconds.
2.2. Create a target tracking scaling rule
If you have not created a scaling group, create one first. For more information, see Create an ECS scaling group and Create an ECI scaling group.
A target tracking scaling rule supports scaling down to zero instances. Before you create a target tracking scaling rule, set the Minimum Number of Instances and Maximum Number of Instances for the scaling group based on your business requirements. This defines the boundaries for scale-out and scale-in activities and helps prevent service unavailability or unexpected costs resulting from an incorrect solution design.
Navigate to the scaling rule creation page for your scaling group.
Log on to the Auto Scaling console.
In the navigation pane on the left, click Scaling Groups.
In the top navigation bar, select a region.
Find the scaling group that you want to manage and click Actions in the View Details column.
Click the Scaling Rules and Tasks tab.
On the Scaling Rules tab, click Create Scaling Rule.
On the Create Scaling Rule page, configure the following parameters.
Parameter
Description
Rule Type
Select Target Tracking Scaling Rule.
Metric Type
Select Hybrid Cloud Monitoring.
Monitor Namespace
Select the namespace that you prepared in Step 2.1.
Metric Description
Select the metrics that you prepared in Step 2.1 and the resources that you want to monitor.
Metric Calculation Expression
Enter an expression based on your business requirements. The
+-*/and()operators are supported.ImportantA metric expression can contain a maximum of three different metrics.
The calculated metric must be proportional to the number of instances. This ensures a scale-out occurs when the metric value is above the target and a scale-in occurs when it is below.
Target Value
The target value for the metric expression. The target tracking scaling rule maintains the calculated value of the Hybrid Cloud Monitoring metric at a level that is close to the target value.
Instance Warmup Time
Unit: seconds. An instance in the warmup state is added to the scaling group, but its monitoring data is not reported to Hybrid Cloud Monitoring. When calculating scaling adjustments, Auto Scaling does not count instances in the warmup state as part of the current capacity. This prevents metric fluctuations.
Threshold for Scale-out Alerts
Specifies the number of consecutive times the threshold must be met to trigger the automatically created scale-out event-triggered task.
Threshold for Scale-in Alerts
Specifies the number of consecutive times the threshold must be met to trigger the automatically created scale-in event-triggered task.
Disable Scale-in
This parameter specifies whether to disable scale-in and affects the number of event-triggered tasks that are automatically created.
If you disable scale-in, the target tracking scaling rule creates only a scale-out event-triggered task. No ECS instances or ECI instances are removed from the scaling group.
If you allow scale-in, the target tracking scaling rule creates two event-triggered tasks: one for scale-out and one for scale-in.
After you configure the parameters, click OK to create the target tracking scaling rule.
3. Monitor and optimize the solution
After you create the target tracking scaling rule, continuously monitor your scaling group to ensure it runs as expected. You can review the calculated metric value, scaling activities, and scaling group monitoring data to verify its behavior.
Related operations
View information about the target tracking scaling rule
On the tab, find the target tracking scaling rule that you created and click the scaling rule ID to view its details. You can click an associated event-triggered task to view its monitoring information.
Monitor the calculated metric value
After you create a target tracking scaling rule, two Event-triggered Task (Hybrid Cloud Monitoring) are automatically created. On the tab, find the corresponding task and click its ID to go to the task details page and view the calculated metric values.
View scaling activities
On the tab, view the logs of scaling activities in the scaling group.
Create a rule with the API
Call the CreateScalingRule operation to create a target tracking scaling rule based on Hybrid Cloud Monitoring metrics. Key parameters are described below.