Concurrent settings and optimization of the tomcat6 Server

Source: Internet
Author: User

Tomcat server. xml configuration file description:

Server. conf configuration

[HTML]View plaincopyprint?

  1. <Connector Port = "8080" protocol = "HTTP/1.1"

  2. Maxthreads = "30000"

  3. Minsparethreads = "512"

  4. Maxsparethreads = "2048"

  5. Enablelookups = "false"

  6. Redirectport = "8443"

  7. Acceptcount = "35000"

  8. DEBUG = "0"

  9. Connectiontimeout = "40000"

  10. Disableuploadtimeout = "true"

  11. Uriencoding = "UTF-8"/>





Parameter description:
Connectiontimeout
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.
Keepalivetimeout
The maximum persistence time (in milliseconds) for persistent connections ). This is 15 seconds.
Maxkeepaliverequests
Maximum number of persistent connections (1 indicates disabled,-1 indicates no limit, default 100. It is generally set to 100 ~ Between 200)
Maxhttpheadersize
The maximum length of HTTP request header information. Generally 8 K.
Uriencoding
Specifies the URL encoding format of the Tomcat container.
Acceptcount
Specify the number of threads that can be used to process requests. The number of requests that can be placed in the processing queue will not be processed. The default value is 10.
Disableuploadtimeout
Whether to use the timeout Mechanism During upload
Enablelookups
Whether to reverse query the domain name. Valid values: true or false. Set to false to improve processing capability.
Maxsparethreads
The maximum number of idle connections. Once the created thread exceeds this value, Tomcat will close the socket thread that is no longer needed. The default value is 50.
Maxthreads
The maximum number of connections simultaneously processed. Tomcat uses a thread to process each request received. This value indicates the maximum number of threads that Tomcat can create.
Minsparethreads
The minimum number of Idle threads and the number of threads created during Tomcat initialization.
Minprocessors
The 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.


APR (Apache Portable Runtime) in the tomcat configuration file)
Configuration information in the server. xml file:
<Listener classname = "org. Apache. Catalina. Core. aprlifecyclelistener" slengine = "on"/>
See: http://hi.baidu.com/xionglian1123/blog/item/e21877dbe89a4e2710df9b44.html


Methods to Improve Tomcat's concurrency
1. Apache and tomcat are combined to use Apache for static pages, while Tomcat for dynamic pages, while reducing the connectiontimeout time to cope with situations where large concurrent threads cannot be recycled.
2. If the stress is too high, Server Load balancer can be implemented. A tomcat cannot handle so many thread loads at any time. Moreover, if the JVM is too large, the memory management costs will increase significantly. 2 GB memory, making 3-4 Tomcat instances (512ram * 4), more scientific and reasonable.
3. For database connection pools, c3p0 is recommended for many users, which can improve the concurrent performance of database access by several times. (Some blog posts said it is better to use the JDBC-pool that comes with Tomcat. I have not tried it yet)
4. Tomcat clusters can maximize the performance of servers. You can deploy multiple Tomcat servers on servers with high configurations, or deploy Tomcat on multiple servers, apache and tomcat are integrated in JK mode. After verification, the system responds to a large number of users. Apache + 3366cat cluster> Apache + 2tomcat cluster> Apache integrated Tomcat> A single Tomcat cluster. In addition, when you deploy Apache + Multi-Tomcat clusters, if a tomcat instance goes down, the system can continue to use it. Therefore, when the hardware system performance is superior enough, to maximize the performance of the software, you can add a tomcat cluster.
5. Enable keepalive support
Keepalive on, keepalivetimeout 15 maxkeepaliverequests 1000
Based on actual experience, the effect of improving system performance through Apache and tomcat clusters is very obvious. This method can maximize the use of hardware resources, the processing of multiple Tomcat servers is used to share the pressure on a single Tomcat server.
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.


This article from the "O & M home (Q group: 1991706)" blog, please be sure to keep this source http://304076020.blog.51cto.com/7503470/1561985

concurrent settings and optimization of Tomcat 6 server

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.