tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Арсений Зинченко <setev...@gmail.com>
Subject Re: JAVA_OPTS vs CATALINA_OPTS
Date Mon, 27 Jan 2014 15:36:36 GMT
Hi, Dan. Thanks for replay.

> he JVM is only going to accept one value for Xmx and Xms.  Specifying the
same options in JAVA_OPTS and CATALINA_OPTS would just be confusing.

As I says before - we have few Java-application on same machine. So - for
them needs to set Xmx 1G, but for Tomcat - 4G.

> Don’t set these as system variables.  You’d want to define them in
setenv.bat
> Again, don’t set system variables for these.  There’s no reason to set
them system wide.

Same reason - few Java-applications wich all need same Java_opts (exclude
Tomcat).

> Since you’re on Windows, you’re probably running as a service and that’s
going to be a bit different

No, Tomcat started via command line (rather - from .bat script wich call
%catalina_home%/bin/startup.bat).


2014/1/27 Daniel Mikusa <dmikusa@gopivotal.com>

> On Jan 27, 2014, at 9:21 AM, Арсений Зинченко <setevoy4@gmail.com>
wrote:
>
> > Hi.
> >
> > I'm sorry for so kindly question - but needs experts advice...
> >
> > We have a little dispute with my colleague about using this variables.
> >
> > So: have Windows-box machine. On it - runing few different
> > Java-application, including Tomcat.
> >
> > Needs to set memory for Tomcat other, than for all other
> Java-applications.
> >
> > My proposal is set to System variables:
> >
> > JAVA_OPTS "-Xmx1024M -Xms512M -XX:MaxPermSize512M"
> > CATALINA_OPTS "-Xmx4096M -Xms2048M -XX:MaxPermSize=1024M”
>
> Don’t set these as system variables.  You’d want to define them in
> setenv.bat if you’re running from the command prompt or with the Windows
> Service utility (either [1] or [2]), if you’re running as a service.
>
> >
> > But, as he asserts - this is not correct way:
> >
> >
> >   - CATALINA_OPTS must NOT contain memory limits like "Xmx", "Xms" etc;
>
> There are no restrictions to what you can set in CATALINA_OPTS.  You could
> put your memory setting there if you wanted.  Having said that, if you’re
> running as a Windows service then you wouldn’t.  You'd set your heap memory
> settings through the service wrapper (either [1] or [2]).
>
> If you’re running from the console (not likely) or on Linux / Unix then
> you’d set your heap settings in the setenv.sh|bat script.  Again, you could
> put memory settings in CATALINA_OPTS or in JAVA_OPTS.  Setting them in
> CATALINA_OPTS is generally a better choice though because settings in
> CATALINA_OPTS are only applied when Tomcat is started.  If you set them in
> JAVA_OPTS then they’ll be applied when you start and stop the instance,
> something you probably don’t want for your heap settings.
>
> >   - Java Garbage collector will work differently because JAVA_OPTS have
> >   another opts for memory then CATALINA_OPTS, so - this will worse Tomcat
> >   performance;
>
> I’m not sure I follow your logic here.  The JVM is only going to accept
> one value for Xmx and Xms.  Specifying the same options in JAVA_OPTS and
> CATALINA_OPTS would just be confusing.
>
> >   - and so on
> >
> > His suggestion is to set JAVA_OPTS with memory limits exactly to Tomcat
> > startup script (not as system variable at all).
>
> Again, don’t set system variables for these.  There’s no reason to set
> them system wide.
>
> >
> > So, my question is: is it correct to set memory limits for Tomcat via
> > CATALINA_OPTS variable?
>
> Generally, but it depends on how you are starting Tomcat.  Since you’re on
> Windows, you’re probably running as a service and that’s going to be a bit
> different.  See above comments.
>
> > If in system also present JAVA_OPTS - will it have influence on to
> Tomcat's performance?
>
> I think I answered this above.  If it’s not clear, let me know.
>
> >
> > Thanks.
>
> Dan
>
> [1] -
> http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Command_line_parameters
> [2] -
> http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Tomcat7w_monitor_application
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message