tomcat startup memory settings

Its initial space ( ie -Xms) is 1/64 of the physical memory, and the maximum space (-Xmx) is 1/4 of the physical memory . It can be set by using options such as -Xmn -Xms -Xmx provided by the JVM
3. Example, the following is a reference for the parameter setting of java jvm in a 1G memory environment :  
JAVA_OPTS="-server -Xms800m -Xmx800m  -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=128m -Djava.awt.headless=true "
JAVA_OPTS="-server -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=256m -XX:NewSize=192m -XX:MaxNewSize=384m"CATALINA_OPTS="-server -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=256m-XX:NewSize=192m -XX:MaxNewSize=384m" 

 
Linux:
catalina.sh in the /usr/local/apache-tomcat-5.5.23/bin directory
Add: JAVA_OPTS='-Xms512m -Xmx1024m'
To add " m " , it means MB , otherwise it is KB , and it will report insufficient memory when starting tomcat .
-Xms : initial value
-Xmx : maximum value
-Xmn : minimum value
Windows
Add at the top of catalina.bat
set JAVA_OPTS=-Xms128m -Xmx350m
If you start tomcat with startup.bat, the OK setting will take effect. It is enough to allocate 200M of memory successfully.
However, if instead of executing startup.bat to start tomcat, but using the windows system service to start the tomcat service, the above settings will not take effect.
That is to say, set JAVA_OPTS=-Xms128m -Xmx350m does not work. Allocating 200M of memory above is OOM..
The windows service executes bin/tomcat.exe. It reads the values ​​in the registry, not the settings of catalina.bat.
Solution:
Modify the registry HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Tomcat Service Manager/Tomcat5/Parameters/JavaOptions The
original value is
-Dcatalina.home="C:/ApacheGroup/Tomcat 5.0" -Djava.endorsed.dirs
="C: /ApacheGroup/Tomcat 5.0/common/endorsed"
-Xrs
Add -Xms300m -Xmx350m  to restart the tomcat service, the settings will take effect  
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324585330&siteId=291194637
Recommended