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) ?
The answer to the linked question also refers to my presentation, where I explain that so called "container support" in JDK affects nothing but
So, the answer is NO: JVM does not resize other memory areas and does not attempt to satisfy container limits in any other way. You need to control them manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With