You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Feller <af...@lsu.edu> on 2009/03/04 14:30:33 UTC

Management philosophies in regards to MaxThreads and limit on open file descriptors

QUESTION(S):

1. Are there any general philosophies to tuning Tomcat to support
   a high number of maxThreads (1000+)?

2. Is there any rule of thumb for determining the appropriate number
   of open file descriptors?

3. What costs are associated with granting higher amounts of open
   file descriptors?

ENVIRONMENT: RHEL 5, Sun Java 6, Tomcat 6
CONTEXT:

We have recently upped the maximum number of threads for a handful of our
Tomcat servers and have suffered from the "Too many open files" exceptions
from the applications on the server; they also create HTTP connections to
other services.  We have not dealt with many high traffic applications
especially those that consume other services via HTTP.

Thanks!
-- 
Andrew Feller, Analyst
LSU University Information Services
200 Frey Computing Services Center
Baton Rouge, LA 70803
Office: 225.578.3737
Fax: 225.578.6400


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


Re: Management philosophies in regards to MaxThreads and limit on open file descriptors

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew,

On 3/4/2009 8:30 AM, Andrew Feller wrote:
> 2. Is there any rule of thumb for determining the appropriate number
>    of open file descriptors?

As Chuck points out, this will be application-dependent but there is at
least a place to start: if you are using a standard HTTP or AJP
connector, each thread will need two file descriptors to service the
request (one for input, one for output). I'm not sure about how Comet
and NIO connectors work which is why I qualified my statement with the
HTTP/AJP caveat.

Also, if you need 1000+ threads, you probably need a lot of database
connections in your database connection pool (if you have heavy db
usage). You will require the appropriate number of file descriptors for
all of those connections as well.

So, you should be able to at least bet on a minimum number of file
descriptors necessary to simply handle requests and contact your
database. If you also read/write files during request processing,
remember that it's possible to have /every single request thread working
with a file/, so plan ahead: it's better to allocate a lot of unused
memory for file descriptors than to get an OOME on your production box.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmuynsACgkQ9CaO5/Lv0PD9mwCgmY2mtKBAwWx8/gRACByULgqw
DsEAoLKOixuaxpqAs2UmD33gL4D5T+Rq
=WBAG
-----END PGP SIGNATURE-----

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


RE: Management philosophies in regards to MaxThreads and limit on openfile descriptors

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Andrew Feller [mailto:afelle1@lsu.edu]
> Subject: Management philosophies in regards to MaxThreads and
> limit on openfile descriptors
>
> 1. Are there any general philosophies to tuning Tomcat to support
>    a high number of maxThreads (1000+)?

Use 64-bit hardware, OS, and JVM.

> 2. Is there any rule of thumb for determining the appropriate number
>    of open file descriptors?

That's completely application dependent.

> 3. What costs are associated with granting higher amounts of open
>    file descriptors?

Mostly the virtual memory for the process, which is why you likely will need a 64-bit environment.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Management philosophies in regards to MaxThreads and limit on open file descriptors

Posted by Rainer Jung <ra...@kippdata.de>.
On 04.03.2009 14:30, Andrew Feller wrote:
> QUESTION(S):
>
> 1. Are there any general philosophies to tuning Tomcat to support
>     a high number of maxThreads (1000+)?

64 Bit system

> 2. Is there any rule of thumb for determining the appropriate number
>     of open file descriptors?

If your application is already productive, use lsof (a *nix tools "list 
of open files", that shows you all file descriptors of chosen running 
processes, and what they are needed for). Or simply go to /proc/PID/fd 
in the proc file system (PID= process id of the process you are 
interested in) and list the entries of that directory. It is a virtual 
file system and this directory conatins one entry for each used file 
descritor, and in many cases usuefaul additional information (do a long 
listing "ls -l").

> 3. What costs are associated with granting higher amounts of open
>     file descriptors?

Actually not sure. In case those file descriptors mostly come from 
network connections, don't forget the buffers associated with each such 
connection.

Regards,

Rainer

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