Solving too many open files problem Tomcat 6 and Glassfish in Ubuntu EC2 Amazon

When you get a big chunk indexing of Tomcat 6 or Glassfish, somehow the service get error like "too many open files". (Too many open files) at org.apache.solr.core.SolrCore.getSearcher. Restart tomcat service still give us same error. Yes, actually the problem not in tomcat 6 but in your filesystem. So the solution are :

1. Add fs.file-max = 65536 into /etc/sysctl.conf

2. In /etc/security/limits.conf/ add this :
* soft nofile 65535
* hard nofile 65535

3. Edit /etc/pam.d/common-session and add this line :
session required pam_limits.so

Then restart your server and see if your tomcat working again. Credit to lj4newbies

Tags:



You should follow me here

Comments

Thanks for the post! :-)

I'm using Amazon Linux on EC2. There is no common-session file. Should I create one or use the existing config-util file that contains similar commands?

Hi,

I also use Amazon EC2 Ubuntu 64-bit which this files should be existed :
/etc/pam.d/common-session

If you don't, then you can search some PAM installation or leave it and see if your glassfish / tomcat performance.

Add new comment