Tuesday, January 06, 2009

annoying CENTOS problems raising ulimit

My last attempt to raise the open file count on a CentOS server apparently failed. After much dicking around, here is a set of steps that I believe will successfully raise the limit (don't be fooled by whatever you try. If you do a 'ulimit -n' and the returned value is 1024, you have not succeeded in raising the limit).

I did a bunch of reading, and found two postings, that combined seem to have succeeded in upping the max files to 65535.

Mainly I am writing this down so we can remember what the hell I did. These are the two useful posts:
http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/ http://www.centos.org/modules/newbb/viewtopic.php?forum=1&topic_id=559&viewmode=flat

in summary:
1) edit /etc/sysctl.conf to add this line:
fs.file-max = 200000
2) sysctl -p
3)switch to /etc/security/limits.conf and add ther following lines

* soft nofiles 65535
* hard nofiles 65535
4)ulimit -n 65535

I think this worked this time because when I do 'ulimit -n' it returns 65535, whereas prior it always returned 1024. In our previous attempt we only did step 3.

The 200000 value is excessive, but who cares.
I am working on a widget for adding reviews to blogs and websites.

1 comment:

  1. Anonymous2:40 AM

    I think that it should be

    "nofile" instead of "nofiles" in the limits.conf file