In big data application scenarios, especially real-time data analysis and processing, the number of cluster nodes needs to be dynamically adjusted according to data volume changes to provide the required number of resources. The auto scaling function of MRS enables the task nodes of a cluster to be automatically scaled to match cluster loads. If the data volume changes periodically, you can configure an auto scaling rule so that the number of task nodes can be automatically adjusted in a fixed period of time before the data volume changes.
You can configure either auto scaling rules or resource plans or both to trigger auto scaling. Configuring both resource plans and auto scaling rules improves the cluster node scalability to cope with occasionally unexpected data volume peaks.
In some service scenarios, resources need to be reallocated or service logic needs to be modified after cluster scale-out or scale-in. If you manually scale out or scale in a cluster, you can log in to cluster nodes to reallocate resources or modify service logic. If you use auto scaling, MRS enables you to customize automation scripts for resource reallocation and service logic modification. Automation scripts can be executed before and after auto scaling and automatically adapt to service load changes, all of which eliminates manual operations. In addition, automation scripts can be fully customized and executed at various moments, meeting your personalized requirements and improving auto scaling flexibility.
You can configure an auto scaling rule on the Set Advanced Options page during cluster creation or on the Nodes page after the cluster is created.
Configuring an auto scaling rule when creating a cluster
You can configure the auto scaling rules by referring to the following scenarios:
Configure an auto scaling rule for an existing cluster
You can configure the auto scaling rules by referring to the following scenarios:
The following is an example scenario:
The number of nodes needs to be dynamically adjusted based on the Yarn resource usage. When the memory available for Yarn is less than 20% of the total memory, five nodes need to be added. When the memory available for Yarn is greater than 70% of the total memory, five nodes need to be removed. The number of nodes in a task node group ranges from 1 to 10.
Enter a task node range, in which auto scaling is performed. This constraint applies to all scale-in and scale-out rules. The maximum value range allowed is 0 to 500.
The value range in this example is 1 to 10.
To enable Auto Scaling, you must configure a scale-out or scale-in rule.
You can view, edit, or delete the rules you configured in the Scale-out or Scale-in area on the Auto Scaling page. You can click Add Rule to configure multiple rules.
Set Advanced Settings to Configure and click Created, or click Add Automation Script to go to the Automation Script page.
MRS 3.x does not support this operation.
If you want to configure an auto scaling rule for an existing cluster, select I agree to authorize MRS to scale out or in nodes based on the above rule.
If the data volume changes regularly every day and you want to scale out or in a cluster before the data volume changes, you can create resource plans to adjust the number of Task nodes as planned in the specified time range.
Example:
A real-time processing service sees a sharp increase in data volume from 7:00 to 13:00 every day. Assume that an MRS streaming cluster is used to process the service data. Five task nodes are required from 7:00 to 13:00, while only two are required at other time.
For example, set Time Range to 07:00-13:00, and Node Range to 5-5. This indicates that the number of task nodes is fixed at 5 from 07:00 to 13:00.
For details about parameter configurations, see Table 3. You can click Configure Node Range for Specific Time Range to configure multiple resource plans.
Set Advanced Settings to Configure and click Created, or click Add Automation Script to go to the Automation Script page.
MRS 3.x does not support this operation.
If you want to configure an auto scaling rule for an existing cluster, select I agree to authorize MRS to scale out or in nodes based on the above rule.
If the data volume is not stable and the expected fluctuation may occur, the fixed Task node range cannot guarantee that the requirements in some service scenarios are met. In this case, it is necessary to adjust the number of Task nodes based on the real-time loads and resource plans.
The following is an example scenario:
A real-time processing service sees an unstable increase in data volume from 7:00 to 13:00 every day. For example, 5 to 8 task nodes are required from 7:00 to 13:00, and 2 to 4 are required beyond this period. Therefore, you can set an auto scaling rule based on a resource plan. When the data volume exceeds the expected value, the number of Task nodes can be adjusted if resource loads change, without exceeding the node range specified in the resource plan. When a resource plan is triggered, the number of nodes is adjusted within the specified node range with minimum affect. That is, increase nodes to the upper limit and decrease nodes to the lower limit.
Enter a task node range, in which auto scaling is performed. This constraint applies to all scale-in and scale-out rules.
For example, this parameter is set to 2-4 in this scenario.
To enable Auto Scaling, you must configure a scale-out or scale-in rule.
You can view, edit, or delete the rules you configured in the Scale-out or Scale-in area on the Auto Scaling page.
For example, Time Range is set to 07:00-13:00 and Node Range to 5-8.
For details about parameter configurations, see Table 3. You can click Configure Node Range for Specific Time Range or Add Resource Plan to configure multiple resource plans.
Set Advanced Settings to Configure and click Created, or click Add Automation Script to go to the Automation Script page.
MRS 3.x does not support this operation.
If you want to configure an auto scaling rule for an existing cluster, select I agree to authorize MRS to scale out or in nodes based on the above rule.
Cluster Type |
Metric |
Value Type |
Description |
---|---|---|---|
Streaming cluster |
StormSlotAvailable |
Integer |
Number of available Storm slots Value range: 0 to 2147483646 |
StormSlotAvailablePercentage |
Percentage |
Percentage of available Storm slots, that is, the proportion of the available slots to total slots Value range: 0 to 100 |
|
StormSlotUsed |
Integer |
Number of the used Storm slots Value range: 0 to 2147483646 |
|
StormSlotUsedPercentage |
Percentage |
Percentage of the used Storm slots, that is, the proportion of the used slots to total slots Value range: 0 to 100 |
|
StormSupervisorMemAverageUsage |
Integer |
Average memory usage of the Supervisor process of Storm Value range: 0 to 2147483646 |
|
StormSupervisorMemAverageUsagePercentage |
Percentage |
Average percentage of the used memory of the Supervisor process of Storm to the total memory of the system Value range: 0 to 100 |
|
StormSupervisorCPUAverageUsagePercentage |
Percentage |
Average percentage of the used CPUs of the Supervisor process of Storm to the total CPUs Value range: 0 to 6000 |
|
Analysis cluster |
YARNAppPending |
Integer |
Number of pending tasks on YARN Value range: 0 to 2147483646 |
YARNAppPendingRatio |
Ratio |
Ratio of pending tasks on Yarn, that is, the ratio of pending tasks to running tasks on Yarn Value range: 0 to 2147483646 |
|
YARNAppRunning |
Integer |
Number of running tasks on Yarn Value range: 0 to 2147483646 |
|
YARNContainerAllocated |
Integer |
Number of containers allocated to Yarn Value range: 0 to 2147483646 |
|
YARNContainerPending |
Integer |
Number of pending containers on Yarn Value range: 0 to 2147483646 |
|
YARNContainerPendingRatio |
Ratio |
Ratio of pending containers on Yarn, that is, the ratio of pending containers to running containers on Yarn. Value range: 0 to 2147483646 |
|
YARNCPUAllocated |
Integer |
Number of virtual CPUs (vCPUs) allocated to Yarn Value range: 0 to 2147483646 |
|
YARNCPUAvailable |
Integer |
Number of available vCPUs on Yarn Value range: 0 to 2147483646 |
|
YARNCPUAvailablePercentage |
Percentage |
Percentage of available vCPUs on Yarn, that is, the proportion of available vCPUs to total vCPUs Value range: 0 to 100 |
|
YARNCPUPending |
Integer |
Number of pending vCPUs on Yarn Value range: 0 to 2147483646 |
|
YARNMemoryAllocated |
Integer |
Memory allocated to Yarn. The unit is MB. Value range: 0 to 2147483646 |
|
YARNMemoryAvailable |
Integer |
Available memory on Yarn. The unit is MB. Value range: 0 to 2147483646 |
|
YARNMemoryAvailablePercentage |
Percentage |
Percentage of available memory on Yarn, that is, the proportion of available memory to total memory on Yarn Value range: 0 to 100 |
|
YARNMemoryPending |
Integer |
Pending memory on Yarn Value range: 0 to 2147483646 |
Cluster Type |
Metric |
Value Type |
Description |
---|---|---|---|
Custom |
StormSlotAvailable |
Integer |
Number of available Storm slots Value range: 0 to 2147483646 |
StormSlotAvailablePercentage |
Percentage |
Percentage of available Storm slots, that is, the proportion of the available slots to total slots Value range: 0 to 100 |
|
StormSlotUsed |
Integer |
Number of the used Storm slots Value range: 0 to 2147483646 |
|
StormSlotUsedPercentage |
Percentage |
Percentage of the used Storm slots, that is, the proportion of the used slots to total slots Value range: 0 to 100 |
|
StormSupervisorMemAverageUsage |
Integer |
Average memory usage of the Supervisor process of Storm Value range: 0 to 2147483646 |
|
StormSupervisorMemAverageUsagePercentage |
Percentage |
Average percentage of the used memory of the Supervisor process of Storm to the total memory of the system Value range: 0 to 100 |
|
StormSupervisorCPUAverageUsagePercentage |
Percentage |
Average percentage of the used CPUs of the Supervisor process of Storm to the total CPUs Value range: 0 to 6000. |
|
YARNAppPending |
Integer |
Number of pending tasks on YARN Value range: 0 to 2147483646 |
|
YARNAppPendingRatio |
Ratio |
Ratio of pending tasks on Yarn, that is, the ratio of pending tasks to running tasks on Yarn Value range: 0 to 2147483646 |
|
YARNAppRunning |
Integer |
Number of running tasks on Yarn Value range: 0 to 2147483646 |
|
YARNContainerAllocated |
Integer |
Number of containers allocated to Yarn Value range: 0 to 2147483646 |
|
YARNContainerPending |
Integer |
Number of pending containers on Yarn Value range: 0 to 2147483646 |
|
YARNContainerPendingRatio |
Ratio |
Ratio of pending containers on Yarn, that is, the ratio of pending containers to running containers on Yarn. Value range: 0 to 2147483646 |
|
YARNCPUAllocated |
Integer |
Number of virtual CPUs (vCPUs) allocated to Yarn Value range: 0 to 2147483646 |
|
YARNCPUAvailable |
Integer |
Number of available vCPUs on Yarn Value range: 0 to 2147483646 |
|
YARNCPUAvailablePercentage |
Percentage |
Percentage of available vCPUs on Yarn, that is, the proportion of available vCPUs to total vCPUs Value range: 0 to 100 |
|
YARNCPUPending |
Integer |
Number of pending vCPUs on Yarn Value range: 0 to 2147483646 |
|
YARNMemoryAllocated |
Integer |
Memory allocated to Yarn. The unit is MB. Value range: 0 to 2147483646 |
|
YARNMemoryAvailable |
Integer |
Available memory on Yarn. The unit is MB. Value range: 0 to 2147483646 |
|
YARNMemoryAvailablePercentage |
Percentage |
Percentage of available memory on Yarn, that is, the proportion of available memory to total memory on Yarn Value range: 0 to 100 |
|
YARNMemoryPending |
Integer |
Pending memory on Yarn Value range: 0 to 2147483646 |
When the value type is percentage or ratio in Table 2, the valid value can be accurate to percentile. The percentage metric value is a decimal value with a percent sign (%) removed. For example, 16.80 represents 16.80%.
Configuration Item |
Description |
---|---|
Time Range |
Start time and End time of a resource plan are accurate to minutes, with the value ranging from 00:00 to 23:59. For example, if a resource plan starts at 8:00 and ends at 10:00, set this parameter to 8:00-10:00. The end time must be at least 30 minutes later than the start time. |
Node Range |
The number of nodes in a resource plan ranges from 0 to 500. In the time range specified in the resource plan, if the number of Task nodes is less than the specified minimum number of nodes, it will be increased to the specified minimum value of the node range at a time. If the number of Task nodes is greater than the maximum number of nodes specified in the resource plan, the auto scaling function reduces the number of Task nodes to the maximum value of the node range at a time. The minimum number of nodes must be less than or equal to the maximum number of nodes. |
Configuration Item |
Description |
---|---|
Name |
Automation script name. The value can contain only digits, letters, spaces, hyphens (-), and underscores (_) and must not start with a space. The value can contain 1 to 64 characters. NOTE:
A name must be unique in the same cluster. You can set the same name for different clusters. |
Script Path |
Script path. The value can be an OBS file system path or a local VM path.
|
Execution Node |
Select a type of the node where an automation script is executed. NOTE:
|
Parameter |
Automation script parameter. The following predefined variables can be imported to obtain auto scaling information:
|
Executed |
Time for executing an automation script. The following four options are supported: Before scale-out, After scale-out, Before scale-in, and After scale-in. NOTE:
Assume that the execution nodes include Task nodes.
|
Action upon Failure |
Whether to continue to execute subsequent scripts and scale-out/in after the script fails to be executed.
NOTE:
|
The automation script is triggered only during auto scaling. It is not triggered when the cluster node is manually scaled out or in.