Optimize TOMCAT: Increase TOMCAT6 response pool

Source: Internet
Author: User
Find the Server.xml file in the Conf directory under the TOMCAT6 installation directory for editing
Shielding Tomcat default connector:
<!–connector port= "8080″protocol=" Http/1.1″
Connectiontimeout= "20000″
Redirectport= "8443″/-->
To create a connector with high threads:
<connector executor= "Tomcatthreadpool" port= "8080" protocol= "http/1.1" maxhttpheadersize= "8192" Usebodyencodingforuri= "true" maxthreads= "1000" enablelookups= "false" redirectport= "8443" acceptcount= "100" Compression= "On" "compressionminsize=" 2048 "compressablemimetype=" text/html,text/xml,text/javascript,text/css, Text/plain "connectiontimeout=" 20000 "disableuploadtimeout= true" uriencoding= "UTF-8"/>
<connector port= "8080″
Executor= "Tomcatthreadpool" protocol= "http/1.1" redirectport= "8443″maxhttpheadersize=" 8192″usebodyencodingforuri = "true" minprocessors= "100″maxprocessors=" 5000″maxthreads= "5000″minsparethreads=" 1000″maxsparethreads= "4000″" Enablelookups= "false" acceptcount= "100″compression=" on "compressionminsize=" 2048″compressablemimetype= "text/html , Text/xml,text/javascript,text/css,text/plain "connectiontimeout=" 60000″keepalivetimeout= "15000" maxkeepaliverequests= "1" disableuploadtimeout= "true" debug= "0″uriencoding=" utf-8″/>
(Note: Add the response thread number control, add the compression transfer mode, adjust timeout settings, shielding debug mode)
Parameter description:
connectiontimeout-Network connection timeout, in milliseconds. A setting of 0 means never time out, and this setting is hidden. Typically, it can be set to 30000 milliseconds.
KeepAliveTimeout-long connection maximum retention time (ms). Here is 15 seconds.
maxkeepaliverequests-Maximum number of long connections (1 is disabled,-1 indicates unlimited number, default 100). The general setting is between 100~200) the maximum number of HTTP requests that can was held in the pipeline until the connection was closed by the Server. Setting this attribute to 1 disables http/1.0 keep-alive, as as the http/1.1 keep-alive and pipelining. Setting This to-1 allows a unlimited number of pipelined or keep-alive HTTP requests. If not specified, the This attribute was set to 100.
The maximum amount of Maxhttpheadersize-http request header information is not processed in excess of this length. General 8K.
uriencoding-Specifies the URL encoding format for the Tomcat container.
Acceptcount-Specifies the number of requests that can be placed in the processing queue when all available processing requests are used, and requests that exceed this number are not processed and default to 10. Defines the maximum queue length for incoming connection requests while all possible request processing threads. Any requests received when the ' queue is full are refused. The default value is 10.
Disableuploadtimeout-whether to use timeout mechanism when uploading
enablelookups-Checks whether the domain name is reversed, and evaluates to: TRUE or false. To improve processing power, set to False
buffersize-defines the size (in bytes) of the ' buffer to be ' provided for input streams created from this connector. By default, buffers of 2048 bytes are provided.
maxsparethreads– Maximum number of idle connections, and once the thread is created exceeds this value, tomcat closes the socket thread that is no longer needed the maximum number of unused request processing threads T Hat are allowed to exist until the thread pool starts stopping the unnecessary threads. The default value is 50.
MaxThreads-The maximum number of simultaneous connections, Tomcat uses threads to handle each request received. This value represents the maximum number of threads that Tomcat can create. The maximum number of request processing threads to is created by this Connector, which therefore determines the maximum n Umber of simultaneous requests can be handled. If not specified, the This attribute was set to 200.
Minsparethreads-Minimum number of idle threads, number of threads created when Tomcat initializes the count of request processing threads that are created time this Connector is the started. The connector'll also make sure it has specified number of idle processing threads. This attribute should is set to a value smaller than the set for MaxThreads. The default value is 4.
Minprocessors-The minimum number of idle connection threads to improve system processing performance with the default value of 10. (used in TOMCAT4)
Maxprocessors-The maximum number of connection threads, that is, the maximum number of requests that are processed concurrently, with a default value of 75. (used in TOMCAT4)
Note:
TOMCAT4 can be used to control the number of threads by modifying the values of Minprocessors and maxprocessors.
In tomcat5+ the following parameters are mainly adjusted
Maxthreads:tomcat uses threads to handle each request that is received. This value represents the maximum number of threads that Tomcat can create.
Acceptcount: Specifies the number of requests that can be placed in the processing queue when all available processing requests are used, and requests that exceed this number will not be processed.
Connnectiontimeout: Network connection timeout, in milliseconds. A setting of 0 means never time out, and this setting is hidden. Typically, it can be set to 30000 milliseconds.
Minsparethreads:tomcat the number of threads created when initializing.
Maxsparethreads: Once a thread is created that exceeds this value, tomcat closes the socket thread that is no longer needed.

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.