Installation and use of tomcat7 and tuning of parameters for the number of jvm connections


http://hi.baidu.com/%CE%E2_%F0%A9/blog/item/1313025d3145334efbf2c0a1.htmlResize

JVM #vi

/usr/java/tomcat7/bin/catalina.sh

Add:

JAVA_OPTS="-Xms1024m -Xmx1024m -Xss1024K -XX:PermSize=128m -XX:MaxPermSize=256m"


View Tomcat's JVM memory

Add user.

<role rolename="manager-gui"/>
   <user username="tomcat" password="tomcat" roles="manager-gui"/>


Note: Tomcat7 needs to be restarted after adding.


2. Visit http://localhost:8080/manager/status and enter the username and password added above.


3. Then you can see the memory usage under the following JVM.

JVM
    Free memory: 442.24 MB Total memory: 490.68 MB Max memory: 913.81 MB

Also modify the default connection number setting:

The following red four lines are not in TOMCAT7, you can add them manually, which can basically solve the crash caused by too many connections. The specific value can be set according to the actual situation

    <Connector port="80" protocol="HTTP/1.1" maxThreads=

               "600"    

minSpareThreads="100"

maxSpareThreads="500"

acceptCount="700"

connectionTimeout="20000"

redirectPort=" 8443" />

Parameter explanation:

maxThreads="600" ///Maximum number of threads

minSpareThreads="100"///Number of threads created during initialization

maxSpareThreads="500"///Once the number of threads created exceeds this value, Tomcat will Will close socket threads that are no longer needed.

acceptCount="700"//Specifies that when all available threads for processing requests are used, they can be placed in the processing queue. Requests with more than this number of requests will not be processed

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326802717&siteId=291194637