Target Value Strategy Plugin
The target-value
strategy plugin performs count calculations in order to
keep the value resulting from the APM query at or around a specified target.
It accomplishes this by extrapolating the current metric value and used capacity linearly to determine if a scaling action is required and how many instances need to be added or removed. More specify, the new scaling value is calculated as:
As an example, a policy that tracks memory usage with target defined as 70
(representing 70% of memory usage) and in a scenario where there are 10
instances running will generate a scaling action with scaling factor of
1.1428571429
, which will add 2
new instances when the metric reaches 80
(80% of memory usage) because:
In other words, if with 10 instances the memory usage in 80%, it's expected that with 12 instances the memory usage will be lower and closer to the target value of 70%.
This means that this strategy expects your infrastructure to have the following characteristics:
inverse relationship between metric and number of instances, meaning that adding more instances will cause your metric value to go down.
linear response to infrastructure changes, meaning that a 2x increase in instance count will cut the metric value approximately in half.
Note: These properties may not be true for your infrastructure. Make sure you have a good grasp of your query result dynamic as the number of instances changes.
To fine-tune scaling decisions you can adjust the threshold
configuration.
This value defines a range between 1 ± threshold
where scaling actions with a
scaling factor within this range are ignored. For example, with the default
value of 0.01
only scaling actions with a factor lower than 0.99
and larger
than 1.01
are taken into account.
With a low threshold
you are expected to observe more scaling actions with
smaller changes, while a high threshold
value is expected to generate fewer
scaling actions with bigger changes in count.
Since threshold
is compared against the computed scaling factor, and the
factor is based on your expected metric values and specified target
,
adjusting the threshold
value can take some time and a few trial and error
attempts.
Agent Configuration Options
Policy Configuration Options