viernes, 8 de julio de 2011

Tomcat Memory Configuration

Starting Tomcat from Startup.sh/Startup.bat


In some cases it is useful to start up Tomcat from the startup.sh (linux) or startup.bat (windows) commands that are part of the distributable Tomcat. 

My personal experience with production environments have taught me that it is important to setup JVM arguments  such as the maximum heap size,  minimum heap size,  new generation size and permanent size. Some others might be necessary to take into consideration but it is opt to you to configure them. 

Prior of using the command you have to specify where your JDK is installed. To do so, you have to setup the environment variable "JAVA_HOME" to the location in which you installed it. An example would be like this:
"C:\Program Files\Java\jdk1.6.0_18"
The startup.sh (.bat) command is located under the "bin" folder in your tomcat installation directory. This command works with another important command file that is located under the same "bin" directory called catalina.sh (.bat). In that file you can setup the necessary JVM arguments needed when your are deploying applications in the tomcat web server. In that file you might find something similar to the following line:


set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%
In that line (no carriage return) you can specify the JVM arguments that you want to change as shown bellow:


set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% -Xmx2000m -Xms2000m -Xmn980m -XX:PermSize=256m


Save the changes and you will be ready to start your tomcat server. 


In linux, simply type: ./startup.sh
In Windows typ startup.bat


To stop the server type
In linux: ./shutdown.sh
In windows: ./shutdown.bat


Eric Haag
IT Research and Development 
www.aspsols.com





No hay comentarios:

Publicar un comentario