`

Linux File descriptor limit

 
阅读更多

1. Find out what the current open file descriptor limit is.

 

$more /proc/sys/fs/file-max

753825

 or 

 

$sysctl -a | grep fs.file-max

fs.file-max = 753825

2. View how many open file descriptors are currently being used.

 

$more /proc/sys/fs/file-nr

4080    0       753825

3. Edit the kernel paramneter file /etc/sysctl.conf and add line “fs.file-max=[new value]” to it.

vi /etc/sysctl.conf

fs.file-max = 1000000

4. Apply the changes.

sysctl -p

fs.file-max = 331287

 

User Level FD Limits

The above procedure sets system-wide file descriptors (FD) limits. However, you can limit httpd (or any other users) user to specific limits by editing /etc/security/limits.conf file, enter:
# vi /etc/security/limits.conf
Set httpd user soft and hard limits as follows:
httpd soft nofile 4096
httpd hard nofile 10240

Save and close the file. To see limits, enter:
# su - httpd
$ ulimit -Hn
$ ulimit -Sn


http://www.cyberciti.biz/tips/linux-procfs-file-descriptors.html

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics