Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat Threads Ready

I deployed a web application on a server. I created a script in order to perform load on the application(stress test). The stress generated different requests using 10 threads. I arrived into the following status as shown in the manager of tomcat:

Free memory: 34.57 MB Total memory: 1166.43 MB Max memory: 1166.43 MB

Max threads: 200 Current thread count: 59 Current thread busy: 12 Max processing time: 60295419 ms Processing time: 1.8809264E7 s Request count: 233217 Error count: 8100 Bytes received: 4.11 MB Bytes sent: 7493.59 MB

According to this status 12 threads are busy for servicing the requests while the other 47 threads are in a ready state. There is 34.57 MB of memory available out of 1166.43MB which was initially allocated. I suspect that since tomcat doesn't destroy the non used ready threads, memory is not released but I am not sure. Does any one have any other insights ? Does anyone know how to timeout ready threads ?

Thanks

like image 370
Clint Feher Avatar asked Mar 20 '26 09:03

Clint Feher


1 Answers

Those 47 threads are sitting in tomcats thread pool. They will stay alive for the duration of your application. Creation and destruction of threads can be time consuming so having threads waiting for work in the pool can speed up your application rather than creating a new thread each time you get a request. See the tomcat documentation on how to configure your thread pool (e.g. increasing/decreasing the max threads).

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
    maxThreads="60" minSpareThreads="4"/>
like image 174
krock Avatar answered Mar 22 '26 21:03

krock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!