Skip to content

Commit b0f0353

Browse files
committed
Modified understanding how to override JVM max heap size section
1 parent 9b9008a commit b0f0353

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

modules/nodes-cluster-resource-configure-jdk.adoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,18 @@ this documentation, and may involve setting multiple additional JVM options.
2929
== Understanding how to override the JVM maximum heap size
3030

3131
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+
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
3533
override this behavior, especially if a container memory limit is also set.
3634

3735
There are at least two ways the above can be achieved:
3836

39-
* If the container memory limit is set and the experimental options are
40-
supported by the JVM, set `-XX:+UnlockExperimentalVMOptions
41-
-XX:+UseCGroupMemoryLimitForHeap`.
37+
* If the container memory limit is set and the default options are
38+
supported by the JVM, set `-XX:
39+
-XX:+UseContainerSupport`.
4240
+
4341
[NOTE]
4442
====
45-
The `UseCGroupMemoryLimitForHeap` option has been removed in JDK 11. Use `-XX:+UseContainerSupport` instead.
43+
The `UseCGroupMemoryLimitForHeap` option has been removed in JDK 11. The `-XX:+UseContainerSupport` option is enabled by default.
4644
====
4745
+
4846
This sets `-XX:MaxRAM` to the container memory limit, and the maximum heap size

0 commit comments

Comments
 (0)