You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/08/23 05:33:54 UTC

[GitHub] [openwhisk-runtime-java] chetanmeh edited a comment on issue #74: Dynamically setting the JVM memory limit by reading the Cgroup

chetanmeh edited a comment on issue #74: Dynamically setting the JVM memory limit by reading the Cgroup
URL: https://github.com/apache/openwhisk-runtime-java/pull/74#issuecomment-524178152
 
 
   @mrutkows Currently the java runtime uses openj9 instead of openjdk
   
   https://github.com/apache/openwhisk-runtime-java/blob/a8e666f7b38d533192fce897342037f4ca570a41/core/java8/Dockerfile#L18
   
   Open J9 does not support `-XX:+UseCGroupMemoryLimitForHeap` and instead has a different flag  [UseContainerSupport][1]. This flag is enabled by default in Docker base images we use in OpenWhisk
   
   ```
   $ docker run --rm -m 1g openwhisk/java8action /bin/bash -c 'echo $JAVA_TOOL_OPTIONS'
   -XX:+IgnoreUnrecognizedVMOptions -XX:+UseContainerSupport -XX:+IdleTuningCompactOnIdle -XX:+IdleTuningGcOnIdle
   ```
   
   See also [this blog post][2].
   
   Also j9 does not support `-XX:+PrintFlagsFinal` instead provides [few different flags to get the defaults][3]. Based on that
   
   ```
   $ docker run --rm -m 1g openwhisk/java8action sh -c "java -verbose:sizes -version"
     -Xmca32K        RAM class segment increment
     -Xmco128K       ROM class segment increment
     -Xmcrs200M      compressed references metadata initial size
     -Xmns2M         initial new space size
     -Xmnx128M       maximum new space size
     -Xms8M          initial memory size
     -Xmos6M         initial old space size
     -Xmox512M       maximum old space size
     -Xmx512M        memory maximum
     -Xmr16K         remembered set size
     -Xlp:objectheap:pagesize=4K	 large page size
                     available large page sizes:
                     4K
     -Xlp:codecache:pagesize=4K	 large page size for JIT code cache
                     available large page sizes for JIT code cache:
                     4K
     -Xmso256K       operating system thread stack size
     -Xiss2K         java thread stack initial size
     -Xssi16K        java thread stack increment
     -Xss1M          java thread stack maximum size
   openjdk version "1.8.0_181"
   OpenJDK Runtime Environment (build 1.8.0_181-b13)
   Eclipse OpenJ9 VM (build openj9-0.9.0, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20180813_291 (JIT enabled, AOT enabled)
   OpenJ9   - 24e53631
   OMR      - fad6bf6e
   JCL      - a05586ac based on jdk8u181-b13)
   ```
   
   Per above `-Xmx512M        memory maximum` it appears that it is configured to use 512M when container is launched with 1 GB memory
   
   So I believe we are good here and do not need to explicitly specify memory settings for build version we are using
   
   [1]: https://www.eclipse.org/openj9/docs/xxusecontainersupport/
   [2]: https://royvanrijn.com/blog/2018/05/java-and-docker-memory-limits/#test-6-openj9-nightly
   [3]: https://github.com/eclipse/openj9/issues/527#issuecomment-497003442

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services