-
Bug
-
Resolution: Duplicate
-
P3
-
11.0.1, 12
-
x86_64
-
linux
A DESCRIPTION OF THE PROBLEM :
I'm running java in a docker container on a machine with 32 cores and 120GB ram. If I specify the heap size with Xmx, I can make use of all of that ram. If I specify it with -XX:+UseContainerSupport and -XX:MaxRAMPercentage, I get a MaxHeapSize of at most 32178700288, no matter the parameters I pass to java or docker. I can easily restrict the heap size to *below* 32178700288, but it refuses to ever to above.
As we can see from the output of these commands, anything where the target heap size would be above 32178700288 hit the limit.
$ docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 32178700288 {product} {ergonomic}
$ docker run -it --rm -m 16g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 16322134016 {product} {ergonomic}
$ docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=50 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 32178700288 {product} {ergonomic}
$ docker run -it --rm -m 16g openjdk:11 java -XX:MaxRAMPercentage=50 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 8589934592 {product} {ergonomic}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
* Create a docker machine with a lot of ram (for my tests, it was a n1-standard-32 in gloud
* Run: docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
* Value shows: 32178700288
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Value should show a value that is much larger, presumably 95% of 96gb, minus any other reserved thing.
ACTUAL -
32178700288 bytes
---------- BEGIN SOURCE ----------
docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
docker run -it --rm -m 96g openjdk:11 java -XX:+PrintFlagsFinal -Xmx90G -XX:-UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 96636764160 {product} {command line}
I'm running java in a docker container on a machine with 32 cores and 120GB ram. If I specify the heap size with Xmx, I can make use of all of that ram. If I specify it with -XX:+UseContainerSupport and -XX:MaxRAMPercentage, I get a MaxHeapSize of at most 32178700288, no matter the parameters I pass to java or docker. I can easily restrict the heap size to *below* 32178700288, but it refuses to ever to above.
As we can see from the output of these commands, anything where the target heap size would be above 32178700288 hit the limit.
$ docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 32178700288 {product} {ergonomic}
$ docker run -it --rm -m 16g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 16322134016 {product} {ergonomic}
$ docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=50 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 32178700288 {product} {ergonomic}
$ docker run -it --rm -m 16g openjdk:11 java -XX:MaxRAMPercentage=50 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 8589934592 {product} {ergonomic}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
* Create a docker machine with a lot of ram (for my tests, it was a n1-standard-32 in gloud
* Run: docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
* Value shows: 32178700288
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Value should show a value that is much larger, presumably 95% of 96gb, minus any other reserved thing.
ACTUAL -
32178700288 bytes
---------- BEGIN SOURCE ----------
docker run -it --rm -m 96g openjdk:11 java -XX:MaxRAMPercentage=95 -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions +XX:+UseContainerSupport -version | grep MaxHeapSize
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
docker run -it --rm -m 96g openjdk:11 java -XX:+PrintFlagsFinal -Xmx90G -XX:-UseContainerSupport -version | grep MaxHeapSize
size_t MaxHeapSize = 96636764160 {product} {command line}
- duplicates
-
JDK-8222252 Java ergonomics limits heap to 128GB with disabled compressed oops
- Resolved
- relates to
-
JDK-8224764 Create jtreg test for JDK-8222252
- Resolved