tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Adamovic <ad...@blic.net>
Subject static objects, server.xml and preventing running out of available file descriptors
Date Sat, 23 Sep 2006 16:37:46 GMT
Hi all!

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.

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.

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

*** 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?


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

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

*** What else should I do?

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
http://www.online-utility.org  
http://www.cheapvps.info
http://www.vpsreview.com  





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message