Optimized tomcat memory and connections and tomcat memory

Source: Internet
Author: User

Optimized tomcat memory and connections and tomcat memory

1. Check the memory size that can be set by the system.

Java-Xmx1024M-version (1024 indicates whether the memory can be adjusted to this value)

2. Set tomcat memory

Add the following to the first line in the tomcat_home/bin/catalina. bat (win) or tomcat_home/bin/catalina. sh (linux) file:

Set JAVA_OPTS =-Xms1024m-Xmx1024m

3. View tomcat memory usage

Http: // 127.0.0.1: 8080/manager/status/(Note: logon users must be granted the admin and manager permissions)

4. Increase tomcat connections

In the configuration in the tomcat configuration file server. xml, the parameters related to the number of connections include:

MinProcessors: Minimum number of idle connection threads to improve system processing performance. The default value is 10;

MaxProcessors: Maximum number of connection threads, that is, the maximum number of concurrent requests. The default value is 75;

AcceptCount: Maximum number of connections allowed. The value must be greater than or equal to maxProcessors. The default value is 100;

EnableLookups: whether to check the domain name. The value is true or false. To improve the processing capability, set it to false;

ConnectionTimeout: the network connection times out. Unit: milliseconds. If it is set to 0, it indicates that the request Never times out. This setting has potential risks. Generally, it can be set to 30000 ms. The parameters related to the maximum number of connections are maxProcessors and acceptCount. To increase the number of concurrent connections, increase these two parameters at the same time. The maximum number of connections allowed by the web server is also subject to the kernel parameter settings of the operating system. Generally, Windows has about 2000 connections, and Linux has about 1000 connections.


How to Increase tomcat connections

In the tomcat configuration file server. in the configuration in xml, the connection-related parameters include: minProcessors: the minimum number of idle connection threads to improve system processing performance. The default value is 10 maxProcessors: the maximum number of connection threads, that is: maximum number of concurrent requests. The default value is 75 acceptCount: the maximum number of connections allowed. The value must be greater than or equal to maxProcessors. The default value is 100 enableLookups: whether to check the domain name. The value can be true or false. To improve the processing capability, set falseconnectionTimeout to network connection timeout, in milliseconds. If it is set to 0, it indicates that the request Never times out. This setting has potential risks. Generally, it can be set to 30000 ms. The parameters related to the maximum number of connections are maxProcessors and acceptCount. To increase the number of concurrent connections, increase these two parameters at the same time.

Tomcat connection problems

The processing capability of web containers is basically not much different. If it is too slow, you 'd better find the cause and check the processing capability of your programs, if your program can only process 500 requests per second, it is useless even if the web container is transferred. It is no problem for tomcat to process eight hundred requests per second, I don't know what website you are visiting so high. You can check whether the charged containers have specific performance parameters. We have been using tomcat and jrun, which are similar.

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.