Jvm in tomcat containers in linux uses the catalina. sh memory limit

Source: Internet
Author: User
Tags tomcat

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.