Running Tomcat with Java Server Option


Tags:

To improve performance (most of the time) for Tomcat (and most any other java application server), the server can be run with the Java option "-server", which optimizes performance at startup, and can increase start up time quite a bit in some instances, but typically increases performance under normal use.

This can be set anywhere that you set JVM options, but for Tomcat, I set these options in the tomcat user (tcsh) profile as such:

setenv CATALINA_OPTS "-server -Xms128m -Xmx128m -XX:NewSize=48m -verbose:gc"

in Solaris 10, this setting can be verified by running 'pargs' on the PID, like so:

% pargs 28145
28145:  /usr/jdk/java/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
argv[0]: /usr/jdk/java/bin/java
argv[1]: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
argv[2]: -Djava.util.logging.config.file=/u01/app/tomcat/conf/logging.properties
argv[3]: -server
argv[4]: -Xms128m
argv[5]: -Xmx128m
argv[6]: -XX:NewSize=48m
argv[7]: -verbose:gc
argv[8]: -Djava.endorsed.dirs=/u01/app/tomcat/common/endorsed
argv[9]: -classpath
argv[10]: :/u01/app/tomcat/bin/bootstrap.jar:/u01/app/tomcat/bin/commons-logging-api.jar
argv[11]: -Dcatalina.base=/u01/app/tomcat
argv[12]: -Dcatalina.home=/u01/app/tomcat
argv[13]: -Djava.io.tmpdir=/u01/app/tomcat/temp
argv[14]: org.apache.catalina.startup.Bootstrap
argv[15]: start