Java processes don't use flags for correct heap sizing within docker
See original GitHub issueSee https://blog.csanchez.org/2017/05/31/running-a-jvm-in-a-container-without-getting-killed/.
The -XX:+UseCGroupMemoryLimitForHeap
flag seems to be enabled by default on newer versions of openjdk:8
:
docker run --rm -m 100MB openjdk:8u212 java -XshowSettings:vm -version
but the public base-java
still uses an older one that would need the manual flag:
docker run --rm -m 100MB jitsi/base-java java -XshowSettings:vm -version
This can cause unexpected out of memory / crashes.
The container support has been further improved in JDK 10:
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
How To Configure Java Heap Size Inside a Docker Container
In this tutorial, we'll see how to set JVM parameters in a container that runs a Java process. Although the following applies to...
Read more >Java inside docker: What you must know to not FAIL
You can see it in action on the following Dockerfile. The JVM read that the container is limited to 600M and created a...
Read more >Java using much more memory than heap size (or size ...
The heap size is set to 128 MB ( -Xmx128m -Xms128m ) while the container takes up to 1GB of memory. Under normal...
Read more >Best Practices: Java Memory Arguments for Containers - DZone
When running your Java application in physical servers, you would have been using '-Xmx' JVM argument to specify the Java heap size.
Read more >How to reduce your JVM app memory footprint in Docker and ...
Container overall used memory with different heap flags ... size means the app will not handle bursts well — so this does not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
BTW, this is a helpful tool for setting the JVM memory sizes correctly within docker: https://github.com/cloudfoundry/java-buildpack-memory-calculator https://github.com/meisterplan/jdk-base is a docker image that also uses these calculations
Jigasi is setting JIGASI_MAX_MEMORY=3072m. And by the way, I’ve tested java11 and I’m currently pushing PRs so we can run using java11. Trying to push it these days, release on meet.jit.si and push it to stable.