Memory settings apply to the JVM, not Tomcat
You can create a separate file
%CATALINA_HOME%\bin\setenv.bat
or $CATALINA_HOME/bin/setenv.sh
and put your environment variables there.
so I'd like to set the
JAVA_OPTS
variable instead:set JAVA_OPTS=-Xmx512m
For Xmx:
Specifies the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes.
The default value is 64MB
. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts. So, in simple words, you are saying Java to use Maximum of 1024 MB from available memory.
NOTE: there is NO SPACE between-Xmx
and1024m
Resource Link:
- How to Change JVM Heap Setting (-Xms -Xmx) of Tomcat – Configure setenv.sh file – Run catalina.sh
- How to Increase Apache Tomcat HeapSize (JVM Heap) in Eclipse IDE (integrated development environment) to Avoid OutOfMemory
UPDATE1: Setting Up Multiple Tomcat Instances
Multiple Tomcat instances are possible to create with the use of the CATALINA_BASE environment variable. Each instance uses a common binary distribution but uses its own conf, webapps, temp, logs and work directories. Each instance also has its own JVM and, thereby, its own memory pool. If you have defined the maximum memory to be 512MB via JAVA_OPTS, each instance will attempt to allocate a maximum of 512MB.
For more details, you can go through this tutorial: Connecting Apache's Web Server to Multiple Instances of Tomcat
No comments:
Post a Comment