High concurrent Tomcat7.0 Configuration

Source: Internet
Author: User
Tags set time


1. Tomcat Automatic deployment problem.
tomcat6.x and 7.x by default unpackwars= "true" autodeploy= "true", which means that Tomcat is automatically decompressed and deployed under the Copy War to WebApp, but this is normally turned off. The update is prone to data error problems because the server is not stopped on the line. So unpackwars= "true" autodeploy= "false", but there's a problem here that looks like a small bug for Tomcat. Stop Tomcat, deploy the new war package, and restart, it should be discovered that the new war package and then extract the overwrite old, but the reality is that the new package will not be deployed, the official document description will be redeployed, but the actual situation is not the case. The specific reason is unknown, now in order to ensure the latest code, I was directly deleted original.
2, Tomcat maximum number of threads, the maximum number of queues configuration.
First of all, found that the information on the Internet is very old version, now should be tomcat6.0 or 7.0 of the. So a lot of old configurations are out of date. For example minprocessors,maxprocessors these two values on the internet most of the data description modifies them both, but these two values in
There is no official description of the http://tomcat.apache.org/tomcat-7.0-doc/config/http.html.
Each incoming request requires a thread for the duration of this request. If more simultaneous requests are received than can is handled by the currently available request processing threads, Addi tional threads would be created up to the configured maximum (the value of the MaxThreads attribute). If still more simultaneous requests are received, they are stacked up inside the server socket created by Theconnector To the configured maximum (the value of the Acceptcount attribute). Any further simultaneous requests would receive "connection refused" errors, until resources are available to process them.

If we reach more concurrent requests that are not processed by our current process line, the additional threads will be reconfigured to maximize configuration (the value set by the MaxThreads property). If there are concurrent requirements, they are merged into the server interface created by the connector to maximize configuration (up to the value set by the Acceptcount property).
This is the official Tomcat explanation, in the text is clearly explained, modify the maximum number of connections.

maxthreads: The maximum number of request processing threads to is created by this Connector, which therefore dete Rmines the maximum number of simultaneous requests that can is handled. If not specified, the This attribute was set to 200. If an executor was associated with this connector, this attribute is ignored as the connector would execute tasks using the Executor rather than an internal thread pool.

The maximum number of threads to process the request is determined by connector. This value determines the maximum concurrent number that can currently be processed, and if not set, the default value is 200, and if executor is associated with connector, then this value will be ignored.
acceptcount: The maximum queue length for incoming connection requests while all possible request processing thread s are in use. Any requests received when the ' queue is the ' full would be refused. The default value is 100.

A lot of data on the Internet shows that the maximum number of threads Linux is 1000,window will be higher than a little more than 2000. This should be based on the performance of the machine CPU and so on.

The actual configuration data should be based on their own machine and load situation to try to find an optimal configuration.

3, Tomcat bio,nio,apr Three kinds of advanced connector operation mode.

Tomcat supports the above three modes of operation.

BIO: Synchronous blocking, is a connection to a thread. when the client has a link request, the server starts a thread processing, the link does not operate will cause the resource waste, may consider the thread pool mechanism improvement. The Bio method applies to a smaller number of connections and a fixed architecture, which is more demanding on server resources and is limited to applications.

NIO: synchronization is not blocked, is a request to a thread. all connection requests from the client are registered to the multiplexer, and multiplexer polls to initiate a threading process when the connection has an I/O request. Suitable for the number of connections and relatively short connection of the architecture, such as chat server, concurrency is limited to applications.

AIO: Asynchronous Non-blocking, is a valid request for a thread. the server implementation mode is a valid request for a thread, and the client's I/O requests are completed by the OS and then notified to the server to initiate the threading process. For a large number of connections and a relatively long architecture, such as photo album Server,

4, additional explanations for several commonly used parameters.

connectiontimeout: Network connection timeout, in milliseconds. A setting of 0 will never time out, and can usually be set to 20000 milliseconds.

uriencoding: Specifies the URL encoding format for the Tomcat container.

enablelookups: True, you can obtain the actual hostname of the remote client by calling Request.getremotehost (), or false, and return its IP address instead of a DNS query. It is recommended to set false to improve some performance.

maxthreads: The maximum number of threads for Tomcat start, that is, the number of simultaneous tasks, with a default value of 200

Acceptcount : The number of requests queued, the default value of 100 when the number of tomcat-started threads reaches maximum

Minsparethreads: It means that even if no one uses so many empty threads to wait.

MaxConnections: This seems to be the new parameter, I did not verify. Maximum number of servers to accept and process, bio defaults to MaxThreads value, nio default 10000,apr/native defaults to 8192.

KeepAliveTimeout: This is the time limit for keeping a long connection, and the default is ConnectionTimeout set time.

maxsparethreads: means that if you can empty up to 75 threads, such as 80 people at a time and no one accesses them, then Tomcat will not retain 80 empty threads, but instead close 5 empty. This parameter was also erased in 7.0.

Unpackwars: If True, Tomcat will automatically extract the war file, or else not, and run the application directly from the war file


Attach a few good links to find information:

Http://www.blogjava.net/aoxj/archive/2010/04/29/319706.html

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.