Hi, I am attempting to make my webapps that run in Tomcat to take advantage of the Docker container-specific JVM options such as -XX:MaxRAMPercentage: https://www.eclipse.org/openj9/docs/xxinitialrampercentage/ TL;DR It allows specifying JVM heap as % of the container memory limit rather than using the default 25%.
Running tomcat:9.0.39-jdk11, what I did is specify CATALINA_OPTS=-XX:MaxRAMPercentage=75 which should use 75% of the container memory limit which is 3.702GiB in this case. So I login into the container and execute ps aux to see Tomcat's command arguments: /usr/local/openjdk-11/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -XX:MaxRAMPercentage=75.0 -Duser.timezone=Europe/Copenhagen -Dignore.endorsed.dirs= -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start If I replace "org.apache.catalina.startup.Bootstrap start" with "-XshowSettings:vm -version" and run, this is what I get: Max. Heap Size (Estimated): 2.78G Using VM: OpenJDK 64-Bit Server VM Where 2.78G is 75% of 3.7GiB -- so far so good, the MaxRAMPercentage setting seems to have worked here. But I'm still getting "Cannot allocate memory" exceptions that kill the container when importing large datasets. So I attached a profiler. What I see in the profiler is Max Heap Size 310378496 B, which is only 0.28 GiB. So how much max heap does my webapp have access to -- is it 2.78G or 0.28G? If it's 0.28, why? How do I enforce the 75% RAM setting for the webapp? Martynas atomgraph.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org