views:

34

answers:

1

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

+2  A: 

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"/>
krock
Thanks for your response.Do you think that that this would fix the memory issues ? I mean do you think as I did that since the ready threads are not released, also the memory is not ?
Clint Feher
@Clint Feher the threads themselves will not be using up too much memory (unless you are using huge amounts of ThreadLocals which is unlikely). You will have to look in other parts of the server to find where memory is being used, e.g. see: http://stackoverflow.com/questions/185893
krock