|
1 | 1 | # How is container CPU calculated ?
|
2 | 2 | Kondense resize each container CPU every second with the following steps.
|
3 | 3 |
|
4 |
| -## 1. Calculate average CPU usage of the container. |
| 4 | +## 1. Calculate average CPU usage |
5 | 5 | Kondense calculate the average CPU usage over the last `INTERVAL` seconds. By default, `INTERVAL` is 10 seconds.
|
6 | 6 |
|
7 | 7 | ### 2. Calculate new CPU
|
8 |
| -To calculate the new container CPU, we need the `TARGET_AVG`. By default, `TARGET_AVG` is 0.8 so 80%. |
| 8 | +We need the `TARGET_AVG` to calculate the new CPU. By default, `TARGET_AVG` is 0.8 so 80%. |
9 | 9 |
|
10 | 10 | ```
|
11 | 11 | new_cpu = average_cpu / TARGET_AVG
|
12 | 12 | ```
|
13 | 13 |
|
14 |
| -### 2.1 If `new_cpu` is smaller than current container cpu limit |
| 14 | +### 2.1 If `new_cpu` is smaller than current CPU limit |
15 | 15 |
|
16 |
| -If `new_cpu` is smaller than the current container limit, we just patch container CPU limit with this `new_cpu`. |
| 16 | +If `new_cpu` is smaller than the current CPU limit, we just patch CPU limit with this `new_cpu`. |
17 | 17 |
|
18 |
| -### 2.2 If `new_cpu` is bigger than current container cpu limit |
| 18 | +### 2.2 If `new_cpu` is bigger than current CPU limit |
19 | 19 |
|
20 |
| -If this `new_cpu` is higher than the current CPU container limit, we exponentially increase `new_cpu` with this formula: |
| 20 | +If `new_cpu` is higher than the current CPU limit, we exponentially increase `new_cpu` with this formula: |
21 | 21 | ```
|
22 | 22 | new_cpu = new_cpu + (new_cpu * coeff)²
|
23 | 23 | ```
|
24 | 24 | The bigger the `coeff`, the stronger Kondense will increase the CPU.
|
25 |
| -We patch the container CPU limit with this `new_cpu`. |
| 25 | +We patch the CPU limit with this `new_cpu`. |
0 commit comments