Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213175

Java ergonomics limits heap to 32GB to allow compressed oops

XMLWordPrintable

    • 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}



        1. 118Limit_120G
          21 kB
          Fairoz Matte
        2. 96Glimit_120G
          14 kB
          Fairoz Matte
        3. nolimit_120G
          17 kB
          Fairoz Matte

            bobv Bob Vandette (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: