Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many concurrent request can tomcat handle by Default [closed]

Tags:

java

tomcat

How many requests Tomcat7.0.42 handle at a time.Can we configure the same in any external File.If so where.

like image 296
user1281029 Avatar asked Aug 22 '13 05:08

user1281029


People also ask

How many simultaneous requests can Tomcat handle?

The default installation of Tomcat sets the maximum number of HTTP servicing threads at 200. Effectively, this means that the system can handle a maximum of 200 simultaneous HTTP requests.

What is Max connections in Tomcat?

The default value is 10. maxConnections : the total number of concurrent connections that the server will accept and process. Any additional incoming connections will be placed in a queue until a thread becomes available. The default value for NIO/NIO2 mode is 10,000 and 8,192 for APR/native.

What is the default connection timeout for Tomcat?

The default value is 60000 (i.e. 60 seconds) but note that the standard server. xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds). Unless disableUploadTimeout is set to false, this timeout will also be used when reading the request body (if any).

Does Tomcat queue request?

The accept queue cannot be monitored, but you can get the number of queued requests for tomcat using Executor. The configuration maxThreads="20" means the threadpool has 20 workers at most, can process 20 requests simultaneously. maxQueueSize="30" means that the threadpool can queued at most 30 unprocessed requests.


2 Answers

It depends on the type connector you are using to accept the requests. There is parameter called maxConnections in server.xml that can be configured to throttle the number of incoming requests. Here is the description of maxConnections params for Tomcat 7:

The maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server will not accept any more connections until the number of connections falls below this value. The operating system may still accept connections based on the acceptCount setting. Default value varies by connector type. For BIO the default is the value of maxThreads unless an Executor is used in which case the default will be the value of maxThreads from the executor. For NIO the default is 10000. For APR/native, the default is 8192.

Note that for APR/native on Windows, the configured value will be reduced to the highest multiple of 1024 that is less than or equal to maxConnections. This is done for performance reasons. If set to a value of -1, the maxConnections feature is disabled and connections are not counted

like image 90
Juned Ahsan Avatar answered Sep 22 '22 09:09

Juned Ahsan


In server.xml file you specify maxThreads which specifies maximum number of simultaneous requests that can be handled..

<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"                enableLookups="false" redirectPort="4443" acceptCount="100"                debug="0" connectionTimeout="60000"                 disableUploadTimeout="true" /> 

In Tomcat 7,

The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200.

EDIT : If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool.

For more info, refer this link Tomcat 7 Doc

like image 37
Prateek Avatar answered Sep 21 '22 09:09

Prateek