Op woensdag, 12 november 2008 om 9:56 uur schreef Tomcat Users List <users@tomcat.apache.org>:
Subject: Re: Tomcat threads Date: Wed Nov 12 09:56:01 CET 2008 From: André Warnier <[EMAIL PROTECTED]> Filip Hanik .. and many others - Dev Lists wrote: [...] Thanks for all the answers, very enlightening. In summary thus : - Tomcat (or rather I suppose the Connector) will create new threads as needed to service simultaneous requests, up to the number given in the Connector's maxThreads attributes. - Once such a thread is created, it remains alive after servicing the request for which it was created, and can thus service future requests - The memory usage one sees with "top" under some versions of Linux for each one of these threads is not really cumulative, because most of it is actually shared between the threads. The total really used is only slightly more than what is indicated individually for each thread. In other words, after the first thread is created, each additional thread only adds a relatively small overhead. Now let me elaborate one step further, and let me know if this is correct : If in a Tomcat I have one HTTP Connector and one AJP Connector (used with mod_jk), they are two distinct Connectors. (I don't really expect dissent here, but who knows ?) Each one will create new threads as needed to service requests on *that* Connector, independently of the other Connector. So if I access the same application (webapp) multiple times indifferently through one Connector or the other, this will result in two groups of threads, one group per Connector, each group behaving independently like indicated above in the summary. Right ? If right, then it means one would do better choosing if one can, and always access this application through either one of the Connectors, but not both, right ? Or, considering both groups are in the end executing the same webapp application, would the memory used by the two groups of threads end up being largely shared also anyway ?
The memory is shared between all threads within one JVM process. This is independent of the Connectors. Ronald.