On 9/23/06, Mladen Adamovic <[EMAIL PROTECTED]> wrote:
Hi all!

Hi


I have many problems recently with java.io.IOException: Too many open
files on my Tomcat server for /Online Utility/
<http://www.online-utility.org> (http://www.online-utility.org) web site.
The server runs Linux (Suse 9.3). My web server stop running when runs
out of available file descriptors.

I know it is a common problem (at least it is not uncommon), I googled a
lot about that problems and find a lot, but still I have some questions
and issues.
I want to do everything I can to prevent that behavior.

how about setting the ulimit higher?
ulimit -n 4096
for example. default would be 1024 i suppose.


After analyzing "lsof" (see man lsof) I have seen a lot of files open by
WordNetProcessor class I use.
I use WordNetProcessor in many JSP files and it seems if I use it in
static way using

<%! static WordNetProcessor wordNetProcessor=new WordNetProcessor(); %>

it won't lock many files.

then your WordNetProcessor class is probably buggy. Maybe you should
show us your code to detect where the problem is.


*QUESTIONS:*
*** So, could I assume it is favorably to use static objects whenever
possible?

No! It's very use-case dependent and there is probably no general
answer to this question, since it can differ from application to
application.


*** Could I also tweak my server.xml somehow to use less threads and
therefore to lock less files?
Currently I have :
<Connector port="80" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
Maybe I should lower to maxThreads="20" minSpareThreads="15"
maxSpareThreads="15"? Or something?

you can lower the thread count, but I think it won't help you much. Do
you know how many concurrent users your site actually have?



*** Should I check places where I use BufferedReader for something? If
yes, for what?

I think you should check whether you close the files properly after reading.


*** Should I place some System.gc() at few places in code?

No.


*** What else should I do?


Send the WordNetProcessor code and, as rand note, stop using
scriptlets in jsps :-)

BTW, Since I use Virtuozzo powered VPS for its hosting, it seems that
Virtuozzo lower the number of available file descriptors since most
likely they are shared among all virtual private servers.

Thanks in advance for any advice / comment.


--
Mladen Adamovic

regards
Leon

http://www.online-utility.org
http://www.cheapvps.info
http://www.vpsreview.com







---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to