The Wayback Machine - https://web.archive.org/web/20200606043317/https://github.com/docker/labs/issues/361
Skip to content
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

Best practices for JVM memory management in Docker containers #361

Open
jetztgradnet opened this issue Oct 16, 2017 · 3 comments
Open

Best practices for JVM memory management in Docker containers #361

jetztgradnet opened this issue Oct 16, 2017 · 3 comments
Labels

Comments

@jetztgradnet
Copy link

@jetztgradnet jetztgradnet commented Oct 16, 2017

Which lab is it that you're having issues with?
Lab: Docker for Java Developers

Description

When deploying Java applications in production one usually specifies the amount of memory available to the JVM (-Xmx) and other assorted configuration settings. Unfortunately, this is (usually) static configuration and therefore fixed in the container image. When specifying memory constraints (using cgroups) this is unfortunately not picked up by the JVM automatically, so there should be a section on memory management for dockerized Java apps.

Java9 and Java8 > u131 provide limited support for this, see https://bugs.openjdk.java.net/browse/JDK-8170888 for details.

For older Java releases there is a good script from @fabric8io-images: https://github.com/fabric8io-images/java/blob/master/images/centos/openjdk8/jdk/container-limits

Also, it is not easy to calculate the amount of JVM heap and the resulting cgroup limits, as the JVM also needs memory for other things, e.g. metaspace, JIT, ...

A few words on the whole topic of JVM memory management for containers would be a very good addition. Articles like https://developers.redhat.com/blog/2017/03/14/java-inside-docker/ provide a good starting point.

@arun-gupta
Copy link
Contributor

@arun-gupta arun-gupta commented Oct 16, 2017

@PaulSandoz FYI, could not find Mikael's github handle.

@pgordon9
Copy link

@pgordon9 pgordon9 commented Nov 2, 2018

Would love to see points on how to estimate how much off-heap memory is typically needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants
You can’t perform that action at this time.