Tomcat threads management

2011-04-29 Thread André Warnier

Hi.

versions :
Front-end httpd :
[Mon Apr 25 19:13:18 2011] [notice] Apache/2.2.9 (Debian) DAV/2 mod_jk/1.2.26 
mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations


Tomcat:
Using CATALINA_BASE:   /usr/share/tomcat5.5
Using CATALINA_HOME:   /usr/share/tomcat5.5
Using CATALINA_TMPDIR: /usr/share/tomcat5.5/temp
Using JRE_HOME:   /usr/lib/jvm/java-6-sun/jre
Server version: Apache Tomcat/5.5
Server built:   Oct 15 2008 12:57:44
Server number:  5.5.26.0
OS Name:Linux
OS Version: 2.6.26-2-amd64
Architecture:   amd64
JVM Version:1.6.0_22-b04
JVM Vendor: Sun Microsystems Inc.
vogon2:/usr/share/tomcat5.5/bin#

(both installed from standard Debian package)

in server.xml :

!-- Define an AJP 1.3 Connector on port 8009 --
Connector port=8009  protocol=AJP/1.3
maxThreads=150 minSpareThreads=25
connectionTimeout=5000 backlog=100
enableLookups=false
redirectPort=8443 /

Note that there is no maxSpareThreads attribute, which according to the documentation 
would result in a default value of 50.


Question :

With the above settings for the AJP connector, I run some stress test using the Apache 
ab program to access a Tomcat application, with a concurrency of 100 simultaneous requests.
After the test finishes, the Tomcat Manager's server status shows the situation below, 
with 98 threads alive.


There is only this one test application installed, and after the test above there are no 
more accesses to Tomcat.


Intuitively, I would expect that after some time, the number of live threads would be 
decreasing back to the minSpareThreads value, but that does not seem to be happening.
The number of threads stays at the same level of about 100, apparently forever (at least 
several hours by now).

Is this normal ?

How does Tomcat (or the AJP Connector) manage these threads ?
Should idle ones not disappear after a while ?

(Accessorily, the display below shows Min spare threads: 0 and Max spare threads: 0, 
which does not match the Connector setting)



Tomcat Manager output :

ajp-8009

Max threads: 150 Min spare threads: 0 Max spare threads: 0 Current thread count: 98 
Current thread busy: 1 Keeped alive sockets count: 0
Max processing time: 293263 ms Processing time: 21367.768 s Request count: 15433 Error 
count: 3 Bytes received: 7.47 MB Bytes sent: 371.22 MB

Stage   TimeB Sent  B Recv  Client  VHost   Request
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
S   1 ms0 KB0 KBx.x.x.x host.company.comGET 
/manager/status/all HTTP/1.1
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ?   ?   ?
R   ?   ?   ?   ? 

Re: Tomcat threads management

2011-04-29 Thread Konstantin Kolinko
2011/4/29 André Warnier a...@ice-sa.com:
 Server version: Apache Tomcat/5.5
 Server built:   Oct 15 2008 12:57:44
 Server number:  5.5.26.0

 Intuitively, I would expect that after some time, the number of live threads
 would be decreasing back to the minSpareThreads value, but that does not
 seem to be happening.
 The number of threads stays at the same level of about 100, apparently
 forever (at least several hours by now).
 Is this normal ?

In short: you have to define an Executor -- only it has the ability to
decrease the number of working threads over time.  - That is true for
Tomcat 6 and later.

(You are using Tomcat 5.5 and I just do not remember how it goes
there. IIRC, thread pool in TC 6 was simplified wrt. to 5.5 one).

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org