我使用Ubuntu 10.04(64位),服务器的cpu架构是x86_64,客户端是i686.现在我把我的fd限制提高到了40万.@H_404_3@
>使用大号的可能的副作用是什么?的文件描述符?
>我怎么知道不.任何进程使用的文件描述符?@H_404_3@
日Thnx@H_404_3@
解决方法
从最近的linux / Documentation / sysctl / fs.txt:@H_404_3@
file-max and file-nr:@H_404_3@
The kernel allocates file handles dynamically,but as yet it doesn’t
free them again.@H_404_3@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.@H_404_3@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.@H_404_3@Attempts to allocate more file descriptors than file-max are reported
with printk,look for “VFS: file-max limit reached”.@H_404_3@
2.6内核使用经验法则来根据系统中的内存量来设置file-max. 2.6内核中fs / file_table.c的片段:@H_404_3@
/* * 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%)@H_404_3@