-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Арсений,

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJS5n9ZAAoJEBzwKT+lPKRYXJAQAIoI/6t21bVVHXGH+KZDVOvy
e+YsyWJRdRtFCDCIc+Y3YtY+8q+uDQRyqBQyJLNgdmkNEdbrGf1a/n74Mg4bNilA
GxOi7D75tiMni3T4rz4nUc5nyTnCOBNYuitrpjZMWfvd/ajHdSAEWuivGa87A/oL
C7Y4Bu6KB+2dwNifOwYWPzRq9yl+25G7SBo+URH8HMTHVEBVrDYflTudX0q9D4XI
XK5CNTiOQvfKgu/3HCjcZSq75LspTIC0Kw9P+GRX9PoJJCvAlF3TQgLghJ9S3YOT
l0n3A5UE2cZycUv3NEJrdoerWbYsbDexq47eeQ2CMVoHeTBBFDAZK4uR7EneFsea
89WI39tNT0+jrScFQ7eKCv72yxUb05gunOnWMHe23vx10BXVT2at8jvgSlJs2SSy
co2B9PrNqwZRZtzZCS38A5DmXts9KlEFnc7bd5Fu4ME4jEs/sODd8+CXc9Fpsmee
68v2w0avaAKjngvirhMq+X12t+NZSIK5TTsz9XA36AGEnDEAgWZUNQ/6GSG2oA2F
tiQzIKkl/MTl8ZEYbI0ZydQgsdhbdvcQ+51dRsqlk1wj+Rlp9d3rOnUgtHn0w4xO
wUid16DjQyCKiqBw+2ATpf6bK1m/cCKQxbkBmfMUXa4wR9Hok3M0fCwsJrHOt74T
1k9HFMAfUZSNelfdCvsC
=M2Q+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to