How to increase the number of threads in a tomcat thread pool?

I just want to know How to increase the number of threads in a tomcat thread pool? and what number to set max too, I don’t know what fits?

+17
threadpool tomcat7
Jun 19 2018-11-11T00:
source share
3 answers

It looks like you should stay with the default settings ;-)

Seriously: the number of maximum concurrent connections you should establish depends on your expected use of tomcat, as well as the number of cores on your server. More cores on your processor => more parallel threads that can be executed.

See here how to configure ...

Tomcat 9: https://tomcat.apache.org/tomcat-9.0-doc/config/executor.html

Tomcat 8: https://tomcat.apache.org/tomcat-8.0-doc/config/executor.html

Tomcat 7: https://tomcat.apache.org/tomcat-7.0-doc/config/executor.html

Tomcat 6: https://tomcat.apache.org/tomcat-6.0-doc/config/executor.html

+20
Oct 18 '11 at 6:24
source share

You will need to customize it to suit your environment.

It is sometimes useful to increase the size of the lag (acceptCount) instead of the maximum number of threads.

Let's say instead

<Connector ... maxThreads="500" acceptCount="50" 

you're using

 <Connector ... maxThreads="300" acceptCount="150" 

you can get much better performance in some cases, because there will be fewer threads contesting resources, and the lag queue will be consumed faster.

In any case, you should do some tests to really know which is better.

+24
Apr 12 2018-12-12T00:
source share

From Tomcat Documentation

MaxConnections When this number is reached, the server will accept, but not process, another connection. once the limit is reached, the operating system can still accept connections based on the acceptCount setting. (The maximum queue length for incoming connection requests when all possible request processing flows are used. Any requests received when the queue is filled will be rejected. The default value is 100.) For BIO, the default value is maxThreads, if only the Executor, in in this case, the default value will be the maxThreads value from the executor. For NIO and NIO2, the default is 10000. For APR / native, the default value is 8192. Note that for APR / native on Windows, the configured value will be reduced to the highest multiple of 1024, which is less than or equal to maxConnections. This is done for performance reasons.

Maxthreads
The maximum number of request processing threads that must be created by this Connector, which determines the maximum number of concurrent requests that can be processed. If this is not specified, this attribute is set to 200. If the worker is associated with this connector, this attribute is ignored because the connector performs tasks using the worker, not the pool of internal threads.

+13
Oct. 20 '15 at 15:46
source share



All Articles