Docker Community Forums

Share and learn in the Docker community.

Java improvements in JDK 10


(Bobvandette) #1

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:

http://jdk.java.net/10/

Improvements:

  1. Improve docker container detection and resource configuration usage
    (JDK-8146115)

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.

-XX:ActiveProcessorCount={xxx}

  1. Allow more flexibility in selecting Heap % of available RAM
    (JDK-8186309)

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.

  1. jcmd attach in linux should be relative to /proc/pid/root and namespace aware
    (JDK-8179498)

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.

Thanks,
Bob Vandette
Java Product Team