Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rewrite the recipe on Tomcat memory configuration. Use CATALINA_OPTS instead of JAVA_OPTS.

...

When your web application is using large memory as this memory size default setting can be too small, 64MB by default,thus the application becomes slower because the garbage collector is invoked more often, and it can even run out of memory (outofmemory / heap space error ). One way to address this problem is to set a larger heap size. In Windows system, this can be done by editing / adding JAVA_OPTS variable (should be early in the file) in

If you start Tomcat by using the standard script files (such as CATALINA_HOME/bin/catalina.bat or catalina.sh), this can be done by setting CATALINA_OPTS environment variable. The recommended way to do so is to create a setenv.bat or setenv.sh file, — read RUNNING.txt for details.

Let for Linux/Unix systems.Parameters to be added are , let say you want to increase it to 256 MB (as you required but make sure you have enough amount of physical memory/RAM and for 32bit system, use no more than 1.0-1.1 GB heap space size ) , use '. Set the CATALINA_OPTS to the value of -Xms256m -Xmx256m' . In some cases , it is better to set slightly lower size for -Xms . There are other parameters can be added , some of them :'-XX:MaxNewSize -XX:NewSize -XX:MaxPermSize' , depending on your application and requirements .

For catalinasetenv.bat there now should be a line in the file that looks like this use the following line:

No Format
 set JAVACATALINA_OPTS=-Xms256m -Xmx256m 

For catalina setenv.sh use the following:

No Format
 JAVACATALINA_OPTS='-Xms256m -Xmx256m' 

There are other parameters that can be added, depending on your application and requirements, e.g: '-XX:MaxPermSize'.

For other parameters, go to * http://wiki.apache.org/tomcat/FAQ/Memory * http://wiki.apache.org/tomcat/OutOfMemorylook at the following pages:

If you are running Tomcat as a Windows service, then environment variables and setenv.bat script have no effect. The relevant settings for the service wrapper application are stored in the Windows registry. They can be edited via Configuration application (tomcat<N>w.exe). See "Java" tab in the configuration dialog. The{{-Xms}} and -Xmx options are configured in fields named "Initial memory pool" and "Maximum memory pool". Other options can be added to "Java Options" field as if they were specified on the command line of java executableand Google and Yahoo are your friends.

How do I make my web application be the Tomcat default application?

...