我使用Ubuntu 10.04(64位),服务器的CPU架构是x86_64,客户端是i686.现在我把我的fd限制提高到了40万.
>使用大号的可能的副作用是什么?的文件描述符?
>我怎么知道不.任何进程使用的文件描述符?
日Thnx
解决方法
从最近的linux / Documentation / sysctl / fs.txt:
file-max and 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.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.Attempts to allocate more file descriptors than file-max are reported
with printk,look for “VFS: file-max limit reached”.
2.6内核使用经验法则来根据系统中的内存量来设置file-max. 2.6内核中fs / file_table.c的片段:
/* * One file with associated inode and dcache is very roughly 1K. * Per default don't use more than 10% of our memory for files. */ n = (mempages * (PAGE_SIZE / 1024)) / 10; files_stat.max_files = max_t(unsigned long,n,NR_FILE);
files_stat.max_files是fs.file-max的设置.对于每1公斤的公羊,最终大约为100(10%)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。