Java RAM Percentage options ignored

5/1/2020

I am running Java8u212 in a Docker container on K8s. The container is setup up with a memory limit of 1GB.

sh-4.2$ cat /sys/fs/cgroup/memory/memory.limit_in_bytes
1073741824

Container startup configurations for Java are provided as follows:

- command:
        - /opt/tools/Linux/jdk/openjdk1.8.0_212_x64/bin/java
        - -XX:+HeapDumpOnOutOfMemoryError
        - -XX:HeapDumpPath=/heap-dump
        - -XX:InitialRAMPercentage=10.0
        - -XX:MinRAMPercentage=50.0
        - -XX:MaxRAMPercentage=80.0
        - -jar
        - app.jar
        - --server.port=8080

However, on logging into the container after startup, I notice that none of the RAM percentage values are configured and values are set to the default.

sh-4.2$  java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|MetaspaceSize|ThreadStackSize | UseContainerSupport | InitialRAMPercentage | MaxRAMPercentage | MinRAMPercentage'
     intx CompilerThreadStackSize                   = 0                                   {pd product}
    uintx ErgoHeapSizeLimit                         = 0                                   {product}
    uintx HeapSizePerGCThread                       = 87241520                            {product}
    uintx InitialBootClassLoaderMetaspaceSize       = 4194304                             {product}
    uintx InitialHeapSize                          := 16777216                            {product}
   double InitialRAMPercentage                      = 1.562500                            {product}
    uintx LargePageHeapSizeThreshold                = 134217728                           {product}
    uintx MaxHeapSize                              := 268435456                           {product}
    uintx MaxMetaspaceSize                          = 18446744073709547520                    {product}
   double MaxRAMPercentage                          = 25.000000                           {product}
    uintx MetaspaceSize                             = 21807104                            {pd product}
   double MinRAMPercentage                          = 50.000000                           {product}
     intx ThreadStackSize                           = 1024                                {pd product}
     bool UseContainerSupport                       = true                                {product}
     intx VMThreadStackSize                         = 1024                                {pd product}
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (Zulu 8.38.0.10-SA-linux64) (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (Zulu 8.38.0.10-SA-linux64) (build 25.212-b04, mixed mode)

What am I missing here? Thanks for looking.

-- frpet
docker
java
jvm
kubernetes
linux-containers

0 Answers