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 16:24:22 GMT
OK, thanks - I'll do it from now (really - never used this file before,
just now found reference to it in catalina.bat) . But - last question,
please: in setenv.bat - must be used CATALINA_OPTS or JAVA_OPTS?


2014/1/27 Christopher Schultz <chris@christopherschultz.net>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Арсений,
>
> On 1/27/14, 10:58 AM, Арсений Зинченко wrote:
> > Thanks, Christopher.
> >
> > OK, what about next:
> >
> > Set JAVA_OPTS as system variable (for all other applications); and
> > create setenv.bat in /bin/ directory with CATALINA_OPTS whith
> > Xmx/Xms for Tomcat?
> >
> > Will it be more correctly than set CATALINA_OPTS as System
> > variable? Or - by the way, in setevn.bat must be used JAVA_OPTS
> > too? <https://plus.google.com/u/0/113253806461878935497?prsrc=4>
> >
> >
> > 2014/1/27 Christopher Schultz <chris@christopherschultz.net>
> >
> > Арсений,
> >
> > On 1/27/14, 9:21 AM, Арсений Зинченко wrote:
> >>>> 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"
> >>>>
> >>>> But, as he asserts - this is not correct way:
> >>>>
> >>>>
> >>>> - CATALINA_OPTS must NOT contain memory limits like "Xmx",
> >>>> "Xms" etc; - Java Garbage collector will work differently
> >>>> because JAVA_OPTS have another opts for memory then
> >>>> CATALINA_OPTS, so - this will worse Tomcat performance; - and
> >>>> so on
> >
> > Tomcat runs Java roughly in this way:
> >
> > $JAVA_HOME/bin/java $JAVA_OPTS $CATALINA_OPTS  \
> > org.apache.catalina.startup.Bootstrap
> >
> > If you have these options configured using both environment
> > variables, then CATALINA_OPTS (the later one) will win because
> > that's how the JVM parses arguments: the last one on the
> > command-line wins. So, it's perfectly safe to do what you have
> > described above.
> >
> > On the other hand, note that since JAVA_OPTS specifies 0.5GiB of
> > heap space for when you are /not/ launching Tomcat, then running
> > "bin\shutdown.bat" will pre-allocate 0.5GiB of heap space just to
> > send the "shutdown" command to a running Tomcat instance, and then
> > terminate. It's kind of a waste.
> >
> > I totally agree with Dan's comments about how using "system
> > variables": just use bin/setenv.bat and keep everything locally.
> >
> >>>> His suggestion is to set JAVA_OPTS with memory limits exactly
> >>>> to Tomcat startup script (not as system variable at all).
> >
> > +1
> >
> >>>> So, my question is: is it correct to set memory limits for
> >>>> Tomcat via CATALINA_OPTS variable? If in system also present
> >>>> JAVA_OPTS - will it have influence on to Tomcat's
> >>>> perfarmance?
> >
> > See above.
> >
> > -chris
>
> I would always recommend that you use bin/setenv.sh (or
> bin\setenv.bat) because you can then set the value differently for
> each Tomcat instance that you have. This becomes an issue if you have
> many different Tomcat instances, which I tend to do.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJS5oLSAAoJEBzwKT+lPKRY8BMP/06E75p4L2fx75ekKgyVFuVX
> vM/tBcP3ulHlEVHAzcTl+gNui4Px0hjRRdKBxU9in/gSRSsD2xkJJa5eXF0EvSn1
> e9BNiVY78JZITSu1wBar0YmIf11EJEtGhhtj/fSkJUxIMhp9YYpM1s9CrxckkIef
> WFQZOnLVdWUq2xxkPiY8AbK7h5zDgo+riBd4HcSC6ymPT0oYCldGIZki7nZ8lxMb
> G3i52aTCiuaOlKYBhdKBsfDdkFJvqF+zZEXdsw+FKP+mKZvpEt5Fn1cWSTX7FXxS
> mWApl7J8FZW+zwX734qUw3ThLIbY2RCwT78VPkPcHK9rbWcKbI4UQ1WIGZeL5U+K
> IqX1MOIJ+dVCJ7rgvtjYWYlfDoovYqfJ6vCoPU5I3Xh0CMzGaKMZY/QZ+gFUXtdu
> 0ym/DQJB13cgjWbOi4YFeL8jNRjgui2UkdtThOzfSzL4eY3C+L5Ca0bb/ExReWTb
> X05q1RVeTB6rTScTYiPCNMKfZ7S2JnXcoXgEeHpKoGo8EPClKLGlLRmFplk/U4Do
> ZdCLLjCavrkEVg6pUEf7UZDJ/qH/VDC0nyNnqJJQHRhjUBh/bMR1yjrzNOnkLOeV
> x0BMEHK8ND76EZ0L5+bwZlAQxvCqjQ/vH1IBmrUsjS60rgMyocJB//UDIZOEOAiq
> 9MXTB+fLRv2ziADmiWJ1
> =QPaR
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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