??????????????????????linux???????ulimit -n ?????????????ε????session?????????????????????£?
????$ulimit -n
????1024
??????????????ulimit -SHn 102400 ??????????????????????????????session??Ч????????????????????????Ч???
?????????????????/etc/security/limits.conf ????????£?
????vi /etc/security/limits.conf
????* hard nofile 102400
????* soft nofile 102400
????????????????μ????????????????????????????
????????????????????????????????????????????????????е?????????????????????????????????????
??????????????
????????????????????????????????????????????????????????????????
????sysctl -w fs.file-max=102400
???????sysctl?????????????????????????????/etc/sysctl.conf???
????fs.file-max=102400
????????????????sysctl -p ?????????Ч??
??????file-max?????????????file-nr????????????????????????????????????????????
??????????????????????????????
????sysctl -w fs.file-max 65536
????????
????echo "65536" > /proc/sys/fs/file-max
????????????????????????????????????????????????????????????????procfs?? psuedo file system????????????????
?????????????????????μ?????
????sysctl -a | grep fs.file-max
????????
????cat /proc/sys/fs/file-max
?????????????
????/etc/sysctl.conf
????echo "fs.file-max=65536" >> /etc/sysctl.conf
????sysctl -p
?????????file handles????????
????sysctl -a | grep fs.file-nr
????????
????cat /proc/sys/fs/file-nr
????825 0 65536
???????????????
????lsof | wc -l
?????????????kernel document?й???file-max??file-nr?????????
file-max & file-nr:
The kernel allocates file handles dynamically?? but as yet it doesn't free them again.
??????????????????????????????????????????
The value in file-max denotes the maximum number of file handles that the Linux kernel will allocate. When you get lots of error messages about running out of file handles?? you might want to increase this limit.
file-max?????linux?????????????????????????????????????????????????????????????????????????????????
Historically?? the three values in file-nr denoted the number of allocated file handles?? the number of allocated but unused file handles?? and the maximum number of file handles. Linux 2.6 always reports 0 as the number of free file handles -- this is not an error?? it just means that the number of allocated file handles exactly matches the number of used file handles.
??kernel 2.6????汾?У?file-nr ?е????????????????????1.??????????????????2.????????????????????????3.????????????????kernel 2.6?汾?е?????????0????????????????????????ζ??????????????????????????????????