2011년 11월 26일 토요일

Linux 파일 핸들 갯수 설정 (ulimit)

System-wide file descriptors

file-max :

file-max denotes the maximum number of file handles that the Linux kernel will allocate.

When you get a lot of error messages about "running out of file handles" , increasing this limit will help.

[root@unixfoo root]# cat /proc/sys/fs/file-max
8192
[root@unixfoo root]# echo 943718 > /proc/sys/fs/file-max
[root@unixfoo root]# cat /proc/sys/fs/file-max
943718
[root@unixfoo root]#



To make the change permanent, add the entries to /etc/sysctl.conf.

[root@unixfoo root]# cat /etc/sysctl.conf
fs.file-max = 943718
[root@unixfoo root]# sysctl -p



file-nr :

The three values in /proc/sys/fs/file-nr 
  • the number of allocated file handles, 
  • the number of allocated but unused file handles, 
  • and the maximum number of file handles. 
You can monitor this to keep a check on the file handles.

Per-process file descriptor limits
  • check the limit
[root@unixfoo root]# ulimit -n
  • become root, increase the limit
[root@unixfoo root]# ulimit -n 16384

댓글 없음:

댓글 쓰기