Java runtime platform JVM (java Virtual Machine) When an application is started, the virtual machine must allocate the most memory and the minimum memory to it. For JAVA, where the memory is crazy, the initial memory and the maximum memory will have a great impact on the performance of the application. For example, when our application uses the maximum memory quota provided by JVM, JVM has to stop our application first.
Sort the work to find garbage that can be returned (release memory occupied by useless objects), and release some occupied memory.
Generally, we add the parameter-X when starting the java program for the maximum and minimum values of our quota.
MS-Xmx to adjust the initial memory and maximum memory of the application, where Xms represents the minimum quota, Xmx represents the maximum quota
.
Some time ago, when I used resin (a free JSP running platform), I set these two parameters in the startup file, but changed tomcat (a very useful JSP running platform)
And later,
Tomcat (a very useful JSP running platform) is not started as a common java program, it is encapsulated, so the two parameters are set
But as long as it is a java program, there is always a place to set this parameter.
After finding some information, we can solve the problem in the following two ways:
1. You need to add tomcat (a good JSP running platform) _ OPTS and CATALINA_OPTS to the environment variables,
For example, SET CATALINA_OPTS =-Xms64m-Xmx512m;
Ms is the smallest, mx is the largest, 64 m, m respectively refers to the memory capacity.
2. Modify the Catalina. bat file
In line 1, "rem Execute Java with the applicable properties ",
% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JA
VA_ENDORSED_DIRS % "-classpath" % CLASSPATH % "-Dcatalina. base =" % CATALINA_BASE %"
-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCL
Replace % CATALINA_OPTS % in ASS % CMD_LINE_ARGS % ACTION % with-Xms64m-Xmx512m
E. g
Update file:
Omcat (a good JSP running platform) incatalina. bat
Update the line
Set JAVA_OPTS =-Xmx256M-Xms64M
Means max cache & min cache