tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jerger <jer...@jerger.org>
Subject Re: How to limit tomcats thread consumption?
Date Tue, 05 Apr 2011 07:34:05 GMT
Hi,

> a) are you sure ? Since, commercially speaking, I can't imagine what
> benefit they would get from this (as opposed to e.g. limiting the amount
> of RAM or disk space), I tend to have a doubt.

unfortunately I am ... and yes, I agree - this option is absolutely mindless 
...

> Also, I am not sure but it seems to me that if there is a maximum number of
> processes built-in, that should be a configurable OS setting in Linux.

This option is set by the VM Hostingsystem - so I can't change this on os 
level.

> b) thread != process.  See e.g.
> http://manpages.ubuntu.com/manpages/intrepid/man7/pthreads.7.html

I know the difference - so to get my process count I use pstree. As I Know 
pstree counts processes (parent and child) - right?

> > Thats quite a huge issue, because I want to operate two virtual hosts:
> > 
> > apache-dev -- tomcat-dev -- mysql
> > apache-www -- tomcat-prod -- mysql
> > 
> > * mysql uses 50 threads in total
> > * apache uses 5
> > * tomcat_prod - 109
> > * tomcat_dev - 73
> 
> c) again, are you not confusing threads and processes ?
> For Apache httpd e.g., depending on the MPM model used, you will be using
> either processes (pre-fork MPM) or threads, or both.

No  I use prefork - but I know the other mpm options to so I will switch to 
threading as soon as I understand the tomcat behaviour.

> In a prefork MPM, that can indeed lead to up to 51 simultaneous *processes*
> (aka 1 main Apache + 50 Apache "children"), IF you have as many
> simultaneous requests being processed. I run many sites with Maxclients
> 20, or less (specially for development sites).

Maxclinets is defined for two v-hosts - prod with 40 and dev with 3 so your 
right, I can save 7 processes here :-)


> > * mod_jk connection_pool_size (3/40), socket_keepalive=false
> 
> There is not really any benefit to have more Apache-Tomcat connections,
> than your MaxClients setting above.

(3/40) means 3 for dev and 40 for prod.

> > * server.xml:
> > 
> > <Executor name="tomcatDevThreadPool" namePrefix="catalina-exec-"
> > 
> >         daemon="false" maxThreads="(3/40)" maxSpareThreads="5"
> > 
> > minSpareThreads="1"/>
> 
> Ideally, you need as many threads as there can be individual *tomcat*
> requests in the course of being processed at the same time.  There is no
> benefit in having (or starting) more than that.
> Since presumably all requests pass first through Apache before there reach
> Tomcat, you need as a maximum number of Tomcat threads, the same number ax
> MaxClients in Apache.

Your right - I will decrease my maxclients for 7. But how can I limit the 
number of tomcat-processes? 
Even if I assume that a java thread is mapped to one os-process I don't 
understand the 109 tomcat processes in a nearly idle tomcat with maxthreads 4 
configured at his only connector!

> >  <Connector executor="tomcatDevThreadPool" port="8009"
> >  
> >       protocol="AJP/1.3" URIEncoding="UTF-8"/>
...
> > Any idea how to cope with this silly process limit?
> 
> Change the provider ?

Yes, thats what I will do - but in meantie I've to cope with this one.

Kind regards,
Michael

Mime
View raw message