-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase default max heap only if memory subsystem is enabled #1797
Increase default max heap only if memory subsystem is enabled #1797
Conversation
JVM should use higher percentage of memory as default max heap when running in a cgroup only if -XX:+UseContainerSupport is specified. Note that -XX:+UseContainerSupport enables JVM to use cgroup's memory subsystem limits. However, a missing check for memory subsystem in MM_GCExtensions::computeDefaultMaxHeap() causes this change to be enabled by default. Fix is to add code for checking memory subsystem is enabled before using higher percentage of cgroup memory limit as default max heap. Signed-off-by: Ashutosh Mehra <asmehra1@in.ibm.com>
I realized the change done in #1517 has become a default behavior.
Note that Xmx gets set to 1.5 G even though I didn't specify Ideally it should be protected by |
I would expect that the JVM uses less memory by default in a container. This has been a significant feature for OpenJ9 compared to other JVMs. We should not be increasing the default Xmx when running in a container. Can you provide more details on the rationale behind #1517? I am wondering if we should be backing #1517 out as this may cause a significant increase in footprint in Cloud environments. @DanHeidinga and @dmitripivkine thoughts since you reviewed #1517? |
@charliegracie #1429 details the reason for the change made in #1517. |
My belief is that OpenJ9 has a smaller footprint for many reasons but one of the major contributors is that by default we do pick as large a -Xmx as other implementations. Also the OpenJ9 GC policies do not expand as aggressively but these 2 features work together. The important part I guess is that we do this iif the container is configured with a max. Is there a default max for docker containers? Can you distinguish between the default value and a value set via the command line / at build time? My personal preference would be to disable this feature if I think the changes for #1517 are actually good for non container JVM instances. In containers I want the heap to be as small as possible (while still providing reasonable performance) and on a single machine I want the heap to be aggressive in using as much resources as allowed. The changes for #1517 are going in the wrong direction in my opinion. |
I think the rationale behind #1517 is that its easier to control the max memory used for the Docker image at deployment then it is to rebuild the docker image with different -Xmx. It gives the user 1 tuneable rather than trying to tune the -Xmx and docker image size. |
There is no default max for docker containers. If the user doesn't specify memory limit for the docker container, it can use as much as it wants, just like any other process running on the host. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@charliegracie This looks like an improvement over the current code which should have included this check from the beginning. As this is GC code, I'll defer to you or @dmitripivkine but I this should be merged. |
JVM should use higher percentage of memory as default max heap when
running in a cgroup only if -XX:+UseContainerSupport is specified.
Note that -XX:+UseContainerSupport enables JVM to use cgroup's memory
subsystem limits.
However, a missing check for memory subsystem in
MM_GCExtensions::computeDefaultMaxHeap() causes this change to be
enabled by default.
Fix is to add code for checking memory subsystem is enabled before using
higher percentage of cgroup memory limit as default max heap.
Signed-off-by: Ashutosh Mehra asmehra1@in.ibm.com