Use math formulae in HPA task page

This commit is contained in:
Tim Bannister 2025-02-11 23:29:43 +00:00
parent b18fcfb162
commit ec950545d4
No known key found for this signature in database
GPG Key ID: 31BA93F2DB289EFE
1 changed files with 11 additions and 7 deletions

View File

@ -10,6 +10,7 @@ feature:
Scale your application up and down with a simple command, with a UI, or automatically based on CPU usage. Scale your application up and down with a simple command, with a UI, or automatically based on CPU usage.
content_type: concept content_type: concept
weight: 90 weight: 90
math: true
--- ---
<!-- overview --> <!-- overview -->
@ -131,14 +132,17 @@ From the most basic perspective, the HorizontalPodAutoscaler controller
operates on the ratio between desired metric value and current metric operates on the ratio between desired metric value and current metric
value: value:
``` ```math
desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )] \begin{equation*}
desiredReplicas = \left( currentReplicas \times { currentMetricValue \over desiredMetricValue } \right)
\end{equation*}
``` ```
For example, if the current metric value is `200m`, and the desired value For example, if the current metric value is `200m`, and the desired value
is `100m`, the number of replicas will be doubled, since `200.0 / 100.0 == is `100m`, the number of replicas will be doubled, since
2.0` If the current value is instead `50m`, you'll halve the number of \\( { 200.0 \div 100.0 } = 2.0 \\).
replicas, since `50.0 / 100.0 == 0.5`. The control plane skips any scaling If the current value is instead `50m`, you'll halve the number of
replicas, since \\( { 50.0 \div 100.0 } = 0.5 \\). The control plane skips any scaling
action if the ratio is sufficiently close to 1.0 (within a globally-configurable action if the ratio is sufficiently close to 1.0 (within a globally-configurable
tolerance, 0.1 by default). tolerance, 0.1 by default).
@ -173,8 +177,8 @@ since it started. This value is configured with the
`--horizontal-pod-autoscaler-cpu-initialization-period` flag, and its `--horizontal-pod-autoscaler-cpu-initialization-period` flag, and its
default is 5 minutes. default is 5 minutes.
The `currentMetricValue / desiredMetricValue` base scale ratio is then The \\( currentMetricValue \over desiredMetricValue \\) base scale ratio is then
calculated using the remaining pods not set aside or discarded from above. calculated, using the remaining pods not set aside or discarded from above.
If there were any missing metrics, the control plane recomputes the average more If there were any missing metrics, the control plane recomputes the average more
conservatively, assuming those pods were consuming 100% of the desired conservatively, assuming those pods were consuming 100% of the desired