Total Pageviews

Thursday, 3 September 2009

Tuning RHEL 4.xx 5.xx file-max, maximum open files on a system

Posted by Jesus Bustos Thu Sep 3 18:00:00 BST 2009

Recently, I came across a request, for setting the maximum open files on a system.

Bear in mind that the amount of memory is the more important to determine the file-max (for your system) , if we have 1280MB of memory we will have to divide this by 4 (256 files per 4M more or less ).

1280M
4M=256 open files
81920 will be the maximum setting for 1280M

1280/4=320

320*256=81920


1) We found that ulimit-n indicates that the number of open files on a system default is 1024

[root @ localhost jbustos] # ulimit-n
1024
2) We can change settings for example ulimit-n 81920

[root @ localhost jbustos] # ulimit-n
81920

[root @ localhost jbustos] #

3) Or by sending echo "number of files" to /proc/sys/fs/file-max

[root @ localhost jbustos] # echo 81920 > /proc/sys/fs/file-max
[root @ localhost jbustos] # cat /proc/sys/fs/file-max
81920

[root @ localhost jbustos] #

******* These changes are not persistent on reboot, we must edit /etc/sysctl.conf and /etc/security/limits.conf, in ordfer to be persistant

4) We edit / etc / security / limits.conf with the following value
" * - nofile 81920"

#
* - nofile 81920


** "-" sets hard and soft limit

5) We then edit /etc/ sysctl.conf with the following parameter
fs.file-max = 81920

# Maximum number of open files
fs.file-max = 81920

6) After this when you can restart your system .
If you run a "ulimit-n "

the result should be 81920





No comments: