Repository navigation
Dynamically setting the JVM memory limit by reading the Cgroup - #74
Liu-HongYe wants to merge 4 commits into
Conversation
…uration during container startup.
|
Fixes #5? |
yep! |
|
Please see article: "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." |
|
@mrutkows Currently the java runtime uses openj9 instead of openjdk Open J9 does not support See also this blog post. Also j9 does not support Per above So I believe we are good here and do not need to explicitly specify memory settings for build version we are using |
|
@chetanmeh was aware of the underlying JVM being used and hoped that J9 had similar options or made similar considerations. In addition, as I have access to some of the IBM JVM people and wanted to better understand where things were at in case we needed to approach them. |
|
@chetanmeh thanks for investigating. I agree that JVM heap size adoption to the action container memory limit should be addressed with #95. The OpenJ9 version we are using now in the managed Java runtime image should adapt to the cgroup's memory limit automatically, because option I think we should close this PR as well as #5 because this area has been addressed. fyi @falkzoll |
|
I too believe this can be closed along with the corresponding issue. Details of heap treatment are well described in contents linked by Chetan (copied here for convenience):
Container memory limit | Maximum Java heap size
Currently, our specific base image uses build 0.14.2 (i.e., x86_64-alpine-jdk8u212-b04_openj9-0.14.2) and this version/changelon indicates the "container aware" heap behavior was added as of "0.11.1" release level: specifically, including a section with: |
|
Okay, I also think we can close this PR. Thx. |
The JVM in the container does not set the memory size limit, which causes the JVM to use 1GB of memory by default. At this time, if the function sets the 256MB memory limit, when the memory uses 256MB, the GC operation cannot be performed in time. The container is killed.
And in the case of the Prewarm container, the memory used by the last call cannot be recycled in time, so the new call available memory is drastically reduced.
I recommend dynamically setting the JVM memory limit by reading the Cgroup configuration during container startup.