Onno, On 03.08.21 04:57, Onno van der Straaten wrote: > Hi, > I was looking at a Tomcat deployment and noticed settings in setenv.sh as > shown below. I noticed that Xms and Xmx is in JAVA_OPTS and CATALINA_OPTS > with the exact same settings. Do these settings make sense? What is the > purpose of repeating those settings? > > I understand that JAVA_OPTS is for the JVM and CATALINA_OPTS is specific to > Tomcat. How do these settings relate to each other? I am assuming they could > be different. > Thanks and Regards, > Onno > > > JAVA_HOME="/usr/lib/jvm/jdk11_0411_oj9" > JAVA_OPTS="-Xms3000m -Xmx3000m" > CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=8375 > -Dcom.sun.management.jmxremote.ssl=false > -Dcom.sun.management.jmxremote.authenticate=false > -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true > -Dfile.encoding=UTF-8 -Dsun.net.inetaddr.ttl=300 -server > -Dorg.apache.tomcat.util.http.Parameters.MAX_COUNT=8192 -Xms3000m -Xmx3000m > -XX:MaxPermSize=500m -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode > -XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails > -Xloggc:"/opt/tomcat/tomcat-9.0.40/logs/garbage.log" > -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M > -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory" >
JAVA_OPTS is used for /any/ start of a JVM, including when you run bin/shutdown.sh, which opens a socket, issues the shutdown command and terminates. Thus, it's an /absolute/ /overkill/ to set -Xms3000m (or any memory setting) in JAVA_OPTS. CATALINA_OPTS is added to these parameers when you start tomcat - thus this is the right place to configure any memory that you need when you run the server. This means that both, JAVA_OPTS and CATALINA_OPTS are used when you run tomcat. If you have conflicting settings in both: You figure out which one takes precedence. I choose to not even try to remember which one takes precedence as I don't trust this to be stable. Your best bet: Leave any memory setting out of JAVA_OPTS. Most likely you don't need any custom JAVA_OPTS in setenv.sh, because you're only interested in configuring settings for the running tomcat. These values safely go into CATALINA_OPTS. Prevent ambiguities. Olaf --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org