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: modules/nodes-cluster-resource-configure-jdk.adoc
+8-7Lines changed: 8 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -29,20 +29,21 @@ this documentation, and may involve setting multiple additional JVM options.
29
29
== Understanding how to override the JVM maximum heap size
30
30
31
31
For many Java workloads, the JVM heap is the largest single consumer of memory.
32
-
Currently, the OpenJDK defaults to allowing up to 1/4 (1/`-XX:MaxRAMFraction`)
33
-
of the compute node's memory to be used for the heap, regardless of whether the
34
-
OpenJDK is running in a container or not. It is therefore *essential* to
32
+
33
+
Currently, on bare metal or VM setups, the OpenJDK's default heap value is 25%, 1/4th of the value (1/`-XX:MaxRamPercentage`). However, within containers using cgroups detection (v1 and v2 for JDK 11/17), the Xmx setting uses 50% of the maximum memory limits. In ubi9 - RHEL 9 images, the default allocation is 80%, leaving 20% for native use. It is therefore *essential* to
35
34
override this behavior, especially if a container memory limit is also set.
36
35
36
+
The `UseContainerSupport` flag is on by default in the JVM. It helps the JVM recognize Docker container operations, automatically fetching container-specific details like CPU count and total memory. Therefore, it is not necessary to manually define `JAVA_MAX_INITIAL_MEM`, as the JVM obtains maximum memory allocation from the pods directly.
37
+
37
38
There are at least two ways the above can be achieved:
38
39
39
-
* If the container memory limit is set and the experimental options are
40
-
supported by the JVM, set `-XX:+UnlockExperimentalVMOptions
41
-
-XX:+UseCGroupMemoryLimitForHeap`.
40
+
* If the container memory limit is set and the default options are
41
+
supported by the JVM, set `-XX:
42
+
-XX:+UseContainerSupport`.
42
43
+
43
44
[NOTE]
44
45
====
45
-
The `UseCGroupMemoryLimitForHeap` option has been removed in JDK 11. Use `-XX:+UseContainerSupport` instead.
46
+
The `UseCGroupMemoryLimitForHeap` option has been removed in JDK 11. The `-XX:+UseContainerSupport` option is enabled by default.
46
47
====
47
48
+
48
49
This sets `-XX:MaxRAM` to the container memory limit, and the maximum heap size
0 commit comments