Several changes targeted at improving the Java execution
experience when running in docker containers have been
integrated into JDK 10. Since we are now on a shortened
release cycle and JDK 10 comes out next March, it would be
great to get feedback as soon as possible. If anyone has a
chance to try these out, you can get early access binaries here:
- Improve docker container detection and resource configuration usage
This change eliminates the need to use experimental options for
enabling the VM to size the Java heap based on available container
memory. The change adds cgroup detection and allows the JVM to configure it’s memory and cpu usage based on container settings. It will not only examine cpusets but will also respond to cpu shares, quotas and
periods. Check out the link above for more detail.
This change also adds a new JVM option to allow users to select the
number of processors that the JVM will use internally to determine
how many threads to create for it’s subsystems.
- Allow more flexibility in selecting Heap % of available RAM
Prior to this change, the JVM only provided the ability to select
a ratio of container memory. This change adds the ability to select
a percentage of container memory to be used for the maximum heap size.
- jcmd attach in linux should be relative to /proc/pid/root and namespace aware
This change corrects a problem not allowing a host JVM to attach to a Java process running inside of a docker container.
For detail on each improvement, look up the Jira issues at https://bugs.openjdk.java.net,
I plan on continuing to improve Java for container environments in each release. If anyone has any concerns or issues, please drop me note.
Java Product Team