You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Onno van der Straaten <os...@onknows.com> on 2021/08/03 02:57:25 UTC
Xms Xmx in JAVA_OPT vs CATALINA_OPTS
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"
Re: Xms Xmx in JAVA_OPT vs CATALINA_OPTS
Posted by Olaf Kock <to...@olafkock.de>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Xms Xmx in JAVA_OPT vs CATALINA_OPTS
Posted by Mark Thomas <ma...@apache.org>.
On August 3, 2021 7:34:37 PM UTC, Adam Elliott <ae...@iMedRIS.com> wrote:
Adam,
As per the reasoning in Olaf's email you really should be using CATALINA_OPTS rather than JAVA_OPTS.
Mark
>From my understanding, setenv is not a default file, and any settings
>inside are "custom". And all of these options are used by the JVM, so
>in your case thy are probably redundant. I only use JAVA_OPTS under
>setenv.sh and use it in a way to add my options to the startup.
>
>export JAVA_OPTS="$JAVA_OPTS\
> -XX:+UseParallelGC\
> -XX:ParallelGCThreads=20\
> -XX:+CMSClassUnloadingEnabled\
> -Xss256k\
> -Xms974M\
> -Xmn974M\
> -Xmx1948M"
>
>Adam
>
>-----Original Message-----
>From: Onno van der Straaten <os...@onknows.com>
>Sent: Monday, August 2, 2021 7:57 PM
>To: users@tomcat.apache.org
>Subject: Xms Xmx in JAVA_OPT vs CATALINA_OPTS
>
>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"
>
>
>CAUTION: This email originated from outside of your organization. Do
>not click links or open attachments unless you recognize the sender and
>know the content is safe. Do not reply to emails that contain a From
>address you are unfamiliar with.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Xms Xmx in JAVA_OPT vs CATALINA_OPTS
Posted by Adam Elliott <ae...@iMedRIS.com>.
From my understanding, setenv is not a default file, and any settings inside are "custom". And all of these options are used by the JVM, so in your case thy are probably redundant. I only use JAVA_OPTS under setenv.sh and use it in a way to add my options to the startup.
export JAVA_OPTS="$JAVA_OPTS\
-XX:+UseParallelGC\
-XX:ParallelGCThreads=20\
-XX:+CMSClassUnloadingEnabled\
-Xss256k\
-Xms974M\
-Xmn974M\
-Xmx1948M"
Adam
-----Original Message-----
From: Onno van der Straaten <os...@onknows.com>
Sent: Monday, August 2, 2021 7:57 PM
To: users@tomcat.apache.org
Subject: Xms Xmx in JAVA_OPT vs CATALINA_OPTS
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"
CAUTION: This email originated from outside of your organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. Do not reply to emails that contain a From address you are unfamiliar with.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org