You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rohan Sahgal <ro...@gmail.com> on 2008/10/07 00:42:01 UTC

Managing Tomcat 6 threads : How to make tomcat destroy threads when idle?

Hi,

I tried increasing the number of tomcat threads.

However, I cannot get tomcat to destroy the threads once they get created
even though tomcat is idle.

I have modified my connector as follows :-
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
                maxThreads="2000" minSpareThreads="20" maxSpareThreads="100"
               redirectPort="8443" />

However I have observed that once 2000 threads are created (I am monitoring
with jconsole), the number never comes down.
The minSpareThreads and maxSpareThreads are ignored.

I could not find their mention in the tomcat docs either, but this was
something I found on a blog post for Tomcat 5.x.

Is there a way to make tomcat reduce the number of threads?

Appreciate all the help.

Thanks,
Rohan

Re: Managing Tomcat 6 threads : How to make tomcat destroy threads when idle?

Posted by Peter Rossbach <pr...@objektpark.de>.
Hi Rohan,

at tomcat 6 you must use an external executor thread pool to decrease  
idle threads:

     <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
         maxThreads="2000" minSpareThreads="20"/>
     <Connector executor="tomcatThreadPool"
                port="8080" protocol="HTTP/1.1"
                connectionTimeout="20000"
                redirectPort="8443" />


Look at http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html
Executor drop idle threads after one minute.

Peter

Am 07.10.2008 um 10:29 schrieb Mark Thomas:

> Rohan Sahgal wrote:
>> I tried increasing the number of tomcat threads.
>>
>> However, I cannot get tomcat to destroy the threads once they get  
>> created
>> even though tomcat is idle.
>>
>> However I have observed that once 2000 threads are created (I am  
>> monitoring
>> with jconsole), the number never comes down.
>> The minSpareThreads and maxSpareThreads are ignored.
>
> Correct - those parameters have no effect.
>
>> I could not find their mention in the tomcat docs either, but this  
>> was
>> something I found on a blog post for Tomcat 5.x.
>
> Tomcat 5.x is not Tomcat 6.x. There are differences and this is one  
> of them.
>
>> Is there a way to make tomcat reduce the number of threads?
>
> Sorry, no.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


Re: Managing Tomcat 6 threads : How to make tomcat destroy threads when idle?

Posted by Mark Thomas <ma...@apache.org>.
Rohan Sahgal wrote:
> I tried increasing the number of tomcat threads.
> 
> However, I cannot get tomcat to destroy the threads once they get created
> even though tomcat is idle.
> 
> However I have observed that once 2000 threads are created (I am monitoring
> with jconsole), the number never comes down.
> The minSpareThreads and maxSpareThreads are ignored.

Correct - those parameters have no effect.

> I could not find their mention in the tomcat docs either, but this was
> something I found on a blog post for Tomcat 5.x.

Tomcat 5.x is not Tomcat 6.x. There are differences and this is one of them.

> Is there a way to make tomcat reduce the number of threads?

Sorry, no.

Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Managing Tomcat 6 threads : How to make tomcat destroy threads when idle?

Posted by Mark Thomas <ma...@apache.org>.
Madhav wrote:
> I am also facing the same issue.
> 
> Btw, do you know how to find these configuration values and more importantly
> the number of 'available' worker threads within a servlet?

Take a look at how the manager app does it for the status page.

Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Managing Tomcat 6 threads : How to make tomcat destroy threads when idle?

Posted by Madhav <rr...@gmail.com>.
I am also facing the same issue.

Btw, do you know how to find these configuration values and more importantly
the number of 'available' worker threads within a servlet?

Thanks,
Madhav

On Tue, Oct 7, 2008 at 4:12 AM, Rohan Sahgal <ro...@gmail.com> wrote:

> Hi,
>
> I tried increasing the number of tomcat threads.
>
> However, I cannot get tomcat to destroy the threads once they get created
> even though tomcat is idle.
>
> I have modified my connector as follows :-
> <Connector port="8080" protocol="HTTP/1.1"
>               connectionTimeout="20000"
>                maxThreads="2000" minSpareThreads="20" maxSpareThreads="100"
>               redirectPort="8443" />
>
> However I have observed that once 2000 threads are created (I am monitoring
> with jconsole), the number never comes down.
> The minSpareThreads and maxSpareThreads are ignored.
>
> I could not find their mention in the tomcat docs either, but this was
> something I found on a blog post for Tomcat 5.x.
>
> Is there a way to make tomcat reduce the number of threads?
>
> Appreciate all the help.
>
> Thanks,
> Rohan
>



-- 
-Madhav