On Tue, Jan 28, 2014 at 4:00 AM, Арсений Зинченко <setev...@gmail.com>wrote: > > About point 4 - this is main goal: as we have few Java-applications > running > in this very system - they must use "global" memory options, thats why I > suggested set System variable JAVA_OPTS. But namely Tomcat - must use > another memory perametrs. >
Arsenije, That's one way of doing it, yes. My personal preference is to keep system-wide settings empty, and then size each Java process separately (in their corresponding startup script). Having said that, it really depends on type of applications you are running on you system. Are they same type of applications, or are they significantly different? If different, I probably want to size them differently, and customize each one of them. Yes, it is easy to set default values in the JAVA_OPTS globally, but that's rarely what I want for my applications. Also, others pointed out - it is confusing to see both JAVA_OPTS and CATALINA_OPTS both setting up -Xmx and -Xms values. Ultimately, everything boils down to a single line: java.exe %JAVA_OPTS% %CATALINA_OPTS% ... java.exe -Xmx1G -Xms512M -Xmx4G -Xms2G ... Yes, the later will override former parameter, but I wouldn't count on it :) Think if you need to add another Java process that requires 4G, how would you set the size of memory of that process? So, unless all Java applications on that box (you said you had only few) - are of similar type and require same sizing, I wouldn't use JAVA_OPTS system-wide setting. > > So, if I correctly understood - for me better solution will be: > > 1) set CATALINA_OPTS with Xmx4G etc - in /bin/setenv.bat; > 2) set JAVA_OPTS with Xmx1G etc - as system variable. > > Yep? > It is TOMCAT_HOME/bin/setenv.bat (wherever you installed Tomcat). Yes, that is one possible solution, if all your Java apps need to be sized the same. I prefer sizing each Java application separately in a script that starts it. Hope that helps! n.