Some time ago, a project memory leakage on the online server caused a large amount of memory to run, resulting in a problem on the entire server. Therefore, the memory limit needs to be fixed. Below is a simple record to change the jvm memory limit:
[Root @ 21 yunwei bin] # cd/usr/local/tomcat_8080/bin/
[Root @ 21 yunwei bin] # ll
Total 792
-Rw-r -- 1 root 27099 Jun 15 16:40 bootstrap. jar
-Rw-r -- 1 root 1647 Jun 15 16:41 catalina-tasks.xml
-Rw-r -- 1 root 13372 Jun 15 16:40 catalina. bat
-Rwxr-xr-x 1 root 21704 Jul 4 07:55 catalina. sh
Go to the bin directory in the project and find catalina. sh and add the following:
CATALINA_OPTS = "$ CATALINA_OPTS-Xms256M-Xmx512M-Xmn256M"
Restart the process as follows:
[Root @ 21 yunwei bin] # ps aux | grep java
Root 314 1.4 7.7 2972648 145444 pts/0 Sl/usr/bin/java-Djava. util. logging. config. file =/usr/local/tomcat_8080/conf/logging. properties-Djava. util. logging. manager = org. apache. juli. classLoaderLogManager-Djdk. tls. ephemeralDHKeySize = 2048-Xms256M-Xmx512M-Xmn256M-Djava. endorsed. dirs =/usr/local/tomcat_8080/endorsed-classpath/usr/local/tomcat_8080/bin/bootstrap. jar:/usr/local/tomcat_8080/bin/tomcat-juli.jar-Dcatalina. base =/usr/local/tomcat_8080-Dcatalina. home =/usr/local/tomcat_8080-Djava. io. tmpdir =/usr/local/tomcat_8080/temp org. apache. catalina. startup. bootstrap start
Root 343 0.0 0.0 9040 672 pts/0 S + grep -- color = auto java
Visible:
Djava. util. logging. manager = org. apache. juli. ClassLoaderLogManager-Djdk. tls. ephemeralDHKeySize = 2048-Xms256M-Xmx512M-Xmn256M has been modified successfully.
The tips are as follows:
1. Description parameters:-Xms256M initial memory size-Xmx512M maximum memory size-Xmn256M minimum memory size
2. Default value: the initial value is 1/64 of the physical memory, and the maximum memory is 1/4 of the physical memory. You can configure the memory configuration and project deployment based on your server configuration.
3. You can set-Xms and-Xmx options to the same, while-Xmn is the-Xmx value of 1/4.