mrutkows commented on issue #74: Dynamically setting the JVM memory limit by reading the Cgroup URL: https://github.com/apache/openwhisk-runtime-java/pull/74#issuecomment-523935812 Please see article: https://medium.com/adorsys/jvm-memory-settings-in-a-container-environment-64b0840e1d9e To make the JVM play well with cgroup memory limits a new option -XX:+UseCGroupMemoryLimitForHeap was introduced. It allows setting the heap to the cgroup memory limit. The JVM reads from /sys/fs/cgroup/memory/memory.limit_in_bytes and uses that value instead of -XX:MaxRAM. ``` $ docker run --rm -m 1g openjdk:8-jdk cat /sys/fs/cgroup/memory/memory.limit_in_bytes 1073741824$ docker run --rm -m 1g openjdk:8-jdk sh -c "java -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -version | grep -Ei 'maxheapsize|maxram'" uintx DefaultMaxRAMFraction = 4 {product} uintx MaxHeapSize := 268435456 {product} # = 1073741824 / 4 uint64_t MaxRAM = 137438953472 {pd product} uintx MaxRAMFraction = 4 {product} ```
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
