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

Java ergonomics limits heap to 128GB with disabled compressed oops

    XMLWordPrintable

Details

    • gc
    • b24
    • x86_64
    • linux

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        Linux, as provided by the openjdk docker image `openjdk:11-jre`

        A DESCRIPTION OF THE PROBLEM :
        When Java container ergonomic options are used to set MaxHeapSize, they are unable to scale beyond a container of 128GB of RAM. For instance, when running `docker run -m200g -it --rm openjdk:11-jre java -XX:-UseCompressedOops -XX:MaxRAMPercentage=50 -version` Java only allocates a 64GB heap (50% of 128GB limit).

        This appears to be due lines 1733-1735 of `src/hotspot/share/runtime/arguments.cpp`, where the effective physical memory is calculated as the minimum of the reported physical memory (in this case from the container limits) and the default value of MaxRAM (128GB):

        ```
          julong phys_mem =
            FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM)
                                    : (julong)MaxRAM;
        ```

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        docker run -m256g -it --rm openjdk:11-jre java -XX:-UseCompressedOops -XX:MaxRAMPercentage=100 -XshowSettings:vm -version

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        VM settings:
            Max. Heap Size (Estimated): 256.00G
            Using VM: OpenJDK 64-Bit Server VM

        openjdk version "11.0.2" 2019-01-15
        OpenJDK Runtime Environment (build 11.0.2+9-Debian-3bpo91)
        OpenJDK 64-Bit Server VM (build 11.0.2+9-Debian-3bpo91, mixed mode)

        ACTUAL -
        VM settings:
            Max. Heap Size (Estimated): 128.00G
            Using VM: OpenJDK 64-Bit Server VM

        openjdk version "11.0.2" 2019-01-15
        OpenJDK Runtime Environment (build 11.0.2+9-Debian-3bpo91)
        OpenJDK 64-Bit Server VM (build 11.0.2+9-Debian-3bpo91, mixed mode)


        CUSTOMER SUBMITTED WORKAROUND :
        When you know you're running in docker, you can set MaxRAM yourself using

        -XX:MaxRAM=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)

        FREQUENCY : always


        Attachments

          1. change-results.out
            3 kB
            Bob Vandette
          2. change-results-2.out
            3 kB
            Bob Vandette
          3. heapcheck
            2 kB
            Bob Vandette

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: