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 09:50:39 GMT
Hi Andre,

thanx very much for the detailed answer ...

> > Maxclinets is defined for two v-hosts - prod with 40 and dev with 3 so
> > your right, I can save 7 processes here :-)
> 
> I am not sure, but you may have the wrong understanding of v-hosts. Are you
> talking about Apache VirtualHosts, or (VMware) virtual machines here ?
> What I mean is that the MaxClients setting for Apache httpd is global, and
> does not apply to VirtualHosts separately.

Sorry for beeing not precise enough. I was talking about apache VirtualHosts.
I've two sites enabled www and dev.
So I've to set Maxclients to the total of both maximums concurrent requests - 
righ? While writing this - I tend to two seperated apache instances - so I can 
set maxclients per web.

> I have no idea how the following is going to show up in an email, but this
> is what I get when I enter "pstree" on one of my linux Debian production
> systems running Apache httpd and tomcat :
> 
> evm2:~# pstree
> init─┬─acpid
>       ├─apache2───25*[apache2]
>       ├─avahi-daemon───avahi-daemon
>       ├─cron
>       ├─dbus-daemon
>       ├─6*[getty]
>       ├─2*[java───14*[{java}]]
>       ├─jsvc─┬─jsvc
>       │      └─jsvc───40*[{jsvc}]
>       ├─klogd
>       ├─nmbd
>       ├─nullmailer-send
>       ├─portmap
>       ├─rpc.statd
>       ├─smbd───3*[smbd]
>       ├─sshd─┬─sshd───bash
>       │      └─sshd───bash───pstree
>       ├─syslogd
>       ├─udevd
>       └─vmware-guestd

Youre right. Unfortunately the difference between thread and process is not 
important to numproc. You can simulate this by entering the following line in 
/etc/security/limits.conf (location for ubuntu):
        "{tomcat-user}        	hard	nproc   	60"

My pstres looks like:

init-+-apache2---8*[apache2]
     |-cron
     |-java---109*[{java}]
     |-java---52*[{java}]
     |-master-+-pickup
     |        |-qmgr
     |        `-tlsmgr
     |-mysqld---48*[{mysqld}]
     |-sshd-+-sshd---sshd---bash---less
     |      `-sshd---bash---pstree
     `-syslogd

So I'm wondering why tomcat needs all these threads and whether I can limit 
these threads ... (on my system tomcat runs as java). It seams to me that my 
tomcat rus about 50 threads in idle mode ... thats quite a lot.
 
> In the case above, the relevant part of the Tomcat (5.5) configuration is
> (I am not using an Executor, just plain Connectors) :

As I know in 5.5 executor is not working - shared executor workes not until 
tomcat7.

>      <Connector port="8180" maxHttpHeaderSize="8192"
>                 maxThreads="50" minSpareThreads="5" maxSpareThreads="25"
>                 enableLookups="false" redirectPort="8443" acceptCount="100"
>                 connectionTimeout="20000" disableUploadTimeout="true" />
> 
>      <Connector port="8009" protocol="AJP/1.3"
> 		connectionTimeout="2000" maxThreads="50" minSpareThreads="10"
> maxSpareThreads="25" />

So in my undaerstanding you have two executor pools - each configured for 
maxthreads 50 - in total 100.

> and Apache httpd settings are :
> 
> <IfModule mpm_prefork_module>
>      StartServers          15
>      MinSpareServers       15
>      MaxSpareServers      25
>      MaxClients          200
>      MaxRequestsPerChild   0
> </IfModule>
> 
> (So as you see, I am not even following my own principles ;-) ).

We all hav to live with diminution :)).

> Are you sure that the problems you have in starting scripts/connecting to
> the system are really due to that process limit ?

Definitely  yes.

> What for instance does the command "netstat -an --tcp" show ?

I've: 
* 5 CloseWaits on Port 80
* 2 Established ssh on Port 22
* 5 Established on Port 8009 (ajp dev)
* 5 Established on Port 8039 (ajp www)
* 40 Established on Port 3306 (mysql)

While writing this - I will have a look to the c3po connection pool settings - 
there is a c3po / spring bug (c3po configuration with <props> works not with 
every versions) ... and ... gotcha  :-)

The correct c3p0 config leads to the following pstree:

init-+-apache2---6*[apache2]
     |-cron
     |-java---109*[{java}]
     |-java---22*[{java}]
     |-master-+-pickup
     |        |-qmgr
     |        `-tlsmgr
     |-mysqld---36*[{mysqld}]
     |-sshd-+-sshd---bash---su---bash
     |      |-sshd---sftp-server
     |      |-sshd---sshd---bash---less
     |      `-sshd---bash---pstree
     `-syslogd


Thanx & Kind regards,
Michael

Mime
View raw message