Skip to content

Commit 340c59b

Browse files
authored
Merge pull request #49718 from sftim/20250211_formulae_hpa
Use math formulae in HPA task page
2 parents da8eb96 + ec95054 commit 340c59b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

content/en/docs/tasks/run-application/horizontal-pod-autoscale.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ feature:
1010
Scale your application up and down with a simple command, with a UI, or automatically based on CPU usage.
1111
content_type: concept
1212
weight: 90
13+
math: true
1314
---
1415

1516
<!-- overview -->
@@ -131,14 +132,17 @@ From the most basic perspective, the HorizontalPodAutoscaler controller
131132
operates on the ratio between desired metric value and current metric
132133
value:
133134

134-
```
135-
desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )]
135+
```math
136+
\begin{equation*}
137+
desiredReplicas = \left( currentReplicas \times { currentMetricValue \over desiredMetricValue } \right)
138+
\end{equation*}
136139
```
137140

138141
For example, if the current metric value is `200m`, and the desired value
139-
is `100m`, the number of replicas will be doubled, since `200.0 / 100.0 ==
140-
2.0` If the current value is instead `50m`, you'll halve the number of
141-
replicas, since `50.0 / 100.0 == 0.5`. The control plane skips any scaling
142+
is `100m`, the number of replicas will be doubled, since
143+
\\( { 200.0 \div 100.0 } = 2.0 \\).
144+
If the current value is instead `50m`, you'll halve the number of
145+
replicas, since \\( { 50.0 \div 100.0 } = 0.5 \\). The control plane skips any scaling
142146
action if the ratio is sufficiently close to 1.0 (within a globally-configurable
143147
tolerance, 0.1 by default).
144148

@@ -173,8 +177,8 @@ since it started. This value is configured with the
173177
`--horizontal-pod-autoscaler-cpu-initialization-period` flag, and its
174178
default is 5 minutes.
175179

176-
The `currentMetricValue / desiredMetricValue` base scale ratio is then
177-
calculated using the remaining pods not set aside or discarded from above.
180+
The \\( currentMetricValue \over desiredMetricValue \\) base scale ratio is then
181+
calculated, using the remaining pods not set aside or discarded from above.
178182

179183
If there were any missing metrics, the control plane recomputes the average more
180184
conservatively, assuming those pods were consuming 100% of the desired

0 commit comments

Comments
 (0)