You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extension/ballastextension/README.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,38 @@ Memory Ballast extension enables applications to configure memory ballast for th
6
6
7
7
The following settings can be configured:
8
8
9
-
-`size_mib` (default = 0, disabled): Is the memory ballast size, in MiB.
9
+
-`size_mib` (default = 0, disabled): Is the memory ballast size, in MiB.
10
+
Takes higher priority than `size_in_percentage` if both are specified at the same time.
11
+
-`size_in_percentage` (default = 0, disabled): Set the memory ballast based on the
12
+
total memory in percentage, value range is `1-100`.
13
+
It is supported in both containerized(eg, docker, k8s) and physical host environments.
14
+
15
+
**How ballast size is calculated with percentage configuration**
16
+
When `size_in_percentage` is enabled with the value(1-100), the absolute `ballast_size` will be calculated by
17
+
`size_in_percentage * totalMemory`. The `totalMemory` can be retrieved for hosts and containers(in docker, k8s, etc) by the following steps,
18
+
1. Look up Memory Cgroup subsystem on the target host or container, find out if there is any total memory limitation has been set for the running collector process.
19
+
Check the value in `memory.limit_in_bytes` file under cgroup memory files (eg, `/sys/fs/cgroup/memory/memory.limit_in_bytes`).
20
+
21
+
2. If `memory.limit_in_bytes` is positive value other than `9223372036854771712`(`0x7FFFFFFFFFFFF000`). The `ballest_size`
22
+
will be calculated by `memory.limit_in_bytes * size_in_percentage`.
23
+
If `memory.limit_in_bytes` value is `9223372036854771712`(`0x7FFFFFFFFFFFF000`), it indicates there is no memory limit has
24
+
been set for the collector process or the running container in cgroup. Then the `totalMemory` will be determined in next step.
25
+
26
+
3. if there is no memory limit set in cgroup for the collector process or container where the collector is running. The total memory will be
27
+
calculated by `github.com/shirou/gopsutil/mem` on `mem.VirtualMemory().total` which is supported in multiple OS systems.
10
28
11
-
Example:
12
29
30
+
Example:
31
+
Config memory ballast size by absolut value in Mib
13
32
```yaml
14
33
extensions:
15
34
memory_ballast:
16
35
size_mib: 64
17
36
```
37
+
38
+
Config memory ballast size in percentage of total memory
0 commit comments