You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Ivan F. Martinez" <bl...@ivanfm.com> on 2003/05/19 19:32:46 UTC

Reduce number of threads...

I have made some changes in our installation and got some problems with tomcat performance, and looking at the code I found why it loads a lot of threads in 2 cases :

org/apache/catalina/core/StandardHost.java
   when liveDeploy = true (default) one thread is created for each host to check for updates at each 15 seconds.
   When you have 50 hosts, then you have 50 threads running. Why don't create a single thread to run the check on all hosts with liveDeploy=true. Instead of starting a new thread on hosts with liveDeploy just put this object reference in a list to be checked by this thread.
   Now we have disabled this in our environment, because it makes a lot of traffic in network. It's very nice to be used, but will be very nice if at least the checkInterval is configurable.


org/apache/catalina/session/StandardManager.java
   each context has one StandardManager wich create a thread executed at each 60 seconds to expire session itens.
   Also this can be made on a single thread to check in all contexts to do the expire.



This changes can make reduction of memory usage and cpu usage.

What do you think about this changes ? I can try to make changes and send a patch, if the developers approve the idea.

Can you give-me your feedback about this idea ?



-- 


Ivan F. Martinez

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Reduce number of threads...

Posted by Remy Maucherat <re...@apache.org>.
Ivan F. Martinez wrote:
> I have made some changes in our installation and got some problems with tomcat performance, and looking at the code I found why it loads a lot of threads in 2 cases :
> 
> org/apache/catalina/core/StandardHost.java
>    when liveDeploy = true (default) one thread is created for each host to check for updates at each 15 seconds.
>    When you have 50 hosts, then you have 50 threads running. Why don't create a single thread to run the check on all hosts with liveDeploy=true. Instead of starting a new thread on hosts with liveDeploy just put this object reference in a list to be checked by this thread.
>    Now we have disabled this in our environment, because it makes a lot of traffic in network. It's very nice to be used, but will be very nice if at least the checkInterval is configurable.
> 
> 
> org/apache/catalina/session/StandardManager.java
>    each context has one StandardManager wich create a thread executed at each 60 seconds to expire session itens.
>    Also this can be made on a single thread to check in all contexts to do the expire.
> 
> 
> 
> This changes can make reduction of memory usage and cpu usage.
> 
> What do you think about this changes ? I can try to make changes and send a patch, if the developers approve the idea.
> 
> Can you give-me your feedback about this idea ?

Yes, those changes are (sort of) obvious and well known. The thing is 
that the current scheme works, so that there's no big urgency to work on 
that.

OTOH, that would be great stuff to have in TC 5 (one thread at the 
server level to handle all those items). Note: for the manager threads, 
it would require some CL tricks, but would be the most useful 
(generally, people have more webapps than hosts).

Fell free to try that refactoring. We'll help improve your patches if 
they need work.

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org