From Java 8 update 191 or later, or Java 10, 11,12, 13 etc. We have option called XX:+UseContainerSupport
that is activated by default, so JVM can read limits for RAM And CPU inside container.
With setting -XX:MaxRAMPercentage=90.0
I can tell JVM how much % of available RAM I want give to HEAP, but what about other JVM resources? like GC, CodeCache, ClassLoading, Metaspace, DirectBuffers and so on?
Does JVM also adapt its sizes (to left space after allocating heap) to not get over available RAM? Or do I still have to calculate it by myself in each case like following:
-XX:MetaspaceSize=64m -XX:ReservedCodeCacheSize=32m -XX:CompressedClassSpaceSize=16m -Xss256k
For example if create a container with 1G RAM and run in it JVM with -XX:MaxRAMPercentage=90.0
, so HEAP will take 900m, and there is will be only 100m for other JVM stuff, does this 100m will be intellectually distributed between all required resources, like setting XX:MaxMetaspaceSize
(which is unlimited by default) ?