Java heap size defaults when running with CGroups in Linux.

Mikael Vidstedt mikael.vidstedt at oracle.com
Wed Nov 30 22:53:41 UTC 2016


Out of curiosity, why wouldn’t this be the default behavior? That is, in which cases is it not a good idea to use the cgroup information when sizing the JVM?

Cheers,
Mikael


> On Nov 30, 2016, at 1:59 PM, Christine Flood <chf at redhat.com> wrote:
> 
> 
> The problem is that when running the JVM inside of a cgroup, such as docker, the JVM bases it's default heap parameters on the size of the whole machine's memory not on the memory available to the container.  This causes errors as discussed on this blog entry.  http://matthewkwilliams.com/index.php/2016/03/17/docker-cgroups-memory-constraints-and-java-cautionary-tale/
> 
> Basically the JVM dies in a non-obvious manner.
> 
> The solution I propose is to add a parameter -XX:+UseCGroupLimits to the JVM which states that you should look to the CGroup when calculating default heap sizes. 
> 
> Webrev is here:  http://cr.openjdk.java.net/~andrew/rh1390708/webrev.01/
> 
> 
> Christine
> 
> 
> 
> 
> 
> 
> 



More information about the hotspot-dev mailing list