Java in a Container: Difference between revisions
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
Generic script that correlates JVM memory settings to the container limits: https://github.com/fabric8io-images/run-java-sh, https://github.com/fabric8io-images/run-java-sh/blob/master/fish-pepper/run-java-sh/fp-files/run-java.sh. | Generic script that correlates JVM memory settings to the container limits: https://github.com/fabric8io-images/run-java-sh, https://github.com/fabric8io-images/run-java-sh/blob/master/fish-pepper/run-java-sh/fp-files/run-java.sh. | ||
=Let JVM Adjust Memory Relative to CGroups Limits= | |||
java -XX:MaxRAMPercentage=20.0 -XX:+PrintFlagsFinal -version | grep MaxHeapSize |
Revision as of 01:18, 6 November 2019
External
- https://developers.redhat.com/blog/2017/03/14/java-inside-docker/
- https://blog.softwaremill.com/docker-support-in-new-java-8-finally-fd595df0ca54
- https://stackoverflow.com/questions/54292282/clarification-of-meaning-new-jvm-memory-parameters-initialrampercentage-and-minr/54297753#54297753
Internal
- Docker Container Best Practices
- Java Memory
- Kubernetes Resources Management Concepts
- Docker Resources Management Concepts
Overview
When running java in a container, the max heap should always be explicitly set with -Xmx, based on the application needs and the container limits.
Java max heap limit can also be calculated based on the container limits.
Generic script that correlates JVM memory settings to the container limits: https://github.com/fabric8io-images/run-java-sh, https://github.com/fabric8io-images/run-java-sh/blob/master/fish-pepper/run-java-sh/fp-files/run-java.sh.
Let JVM Adjust Memory Relative to CGroups Limits
java -XX:MaxRAMPercentage=20.0 -XX:+PrintFlagsFinal -version | grep MaxHeapSize