Scaling policy
When creating an instance group, you can choose how to increase and decrease the number of instances in the group.
The policy is defined in the scale_policy
key in the YAML file.
fixed_scale
The fixed_scale
key defines a fixed-size instance group. The group size is defined in the size
key. You can create a group with the required number of instances within the available quotas and limits.
Here is how a YAML file entry may look like:
...
scale_policy:
fixed_scale:
size: 3
...
Where:
Key | Value |
---|---|
fixed_scale |
Fixed-size instance group |
size * |
Number of VM instances in the group. Acceptable values: 0 to 100. |
* This is a required field.
auto_scale
The auto_scale
key defines an automatically scalable instance group. The initial size of the group is defined in the initial_size
key. You can create a group with the required number of instances within the available quotas and limits.
The VM instance group will be scaled based on the specified metrics: CPU utilization (the cpu_utilization_rule
key) and/or Yandex Monitoring metrics. If multiple metrics are specified in the file, the largest estimated VM instance group size is used.
Here is how a YAML file entry may look like:
scale_policy:
auto_scale:
auto_scale_type: REGIONAL
initial_size: 5
max_size: 15
min_zone_size: 3
measurement_duration: 30s
warmup_duration: 60s
stabilization_duration: 120s
cpu_utilization_rule:
utilization_target: 75
custom_rules:
- rule_type: WORKLOAD
metric_type: GAUGE
metric_name: queue.messages.stored_count
labels:
queue: dj6000000002********
target: 5
Where:
Key | Value |
---|---|
auto_scale |
Automatically scaled instance group |
auto_scale_type |
Type of automatic scaling. The possible values are:
ZONAL . |
initial_size * |
Initial number of instances in the group. The values range from 1 to 100. |
max_size |
Maximum number of VM instances in the group. Acceptable values: 0 to 100. |
min_zone_size |
Minimum number of VM instances per availability zone. Acceptable values: 0 to 100. |
measurement_duration |
Utilization measurement period: The value of each metric is computed as the average of all measurements taken during the period in question. If this value exceeds the target scaling metric value, Instance Groups will increase the number of VM instances in the group. The acceptable values range from 60 to 600 seconds. The default value is 60 seconds. |
warmup_duration |
Instance warmup period. This is a period of time following startup during which the traffic is routed to the VM, while the values of metrics from this VM are not used to scale the group. The average values of the group metrics are used instead. The acceptable values range from 0 to 600 seconds. The default value is zero seconds. |
stabilization_duration |
Stabilization period. After the number of VM instances increases, the group size does not decrease until the stabilization period ends, even if the average scaling metric value drops below the target level. The acceptable values range from 60 to 1,800 seconds. |
cpu_utilization_rule |
Sets the target CPU utilization to run scaling based on the average CPU utilization in the instance group. |
utilization_target |
Target CPU utilization to be supported by Instance Groups. If the average CPU utilization is below the target value, Instance Groups will reduce the number of instances until it reaches min_zone_size in each availability zone.If the average CPU utilization is higher than the target value, Instance Groups will be creating instances until it reaches max_size .The values range from 10 to 100. |
custom_rules |
List of metrics from Yandex Monitoring for automatic scaling. It can include up to three metrics. |
rule_type |
Metric rule type:
|
metric_type |
Type of metric:
|
metric_name |
Name of the metric in Monitoring. |
labels |
Metrics labels from Monitoring. |
target |
Target metric value by which Instance Groups calculates the number of required VM instances. For more information, see Monitoring metrics. |
* This is a required field.
test_auto_scale
The test_auto_scale
key defines a fixed-size instance group with autoscaling testing enabled. The Monitoring tab charts present recommendations on how much to increase or decrease the number of instances depending on the selected metric value; the actual number of instances always remains equal to the size
key value. You can create a group with the required number of instances within the available quotas and limits.
scale_policy:
fixed_scale:
size: 5
test_auto_scale:
initial_size: 5
max_size: 15
min_zone_size: 3
measurement_duration: 30s
warmup_duration: 60s
stabilization_duration: 120s
cpu_utilization_rule:
utilization_target: 75
For test_auto_scale
, use the same keys as for auto_scale
.