我正在处理文件系统中的一亿个文件(分布在很多子目录中),我需要能够非常快速地列出它们,特别是为了有效地进行rsync.
另一方面,我并不需要将文件的实际内容保存在缓存中.
我不断添加和删除文件,但不经常(每秒十次).
有没有办法告诉操作系统(2.6.18-194.el5)在inode缓存上使用24GB可用RAM比在文件缓存上更多?我已经查看了/ proc / etc / vm / vfs_cache_pressure但它似乎并不是我正在寻找的…
如何降低vfs_cache_pressure的值?
根据
Documentation for /proc/sys/vm/*,这应该做你想要的:
vfs_cache_pressure
This percentage value controls the tendency of the kernel to reclaim
the memory which is used for caching of directory and inode objects.
At the default value of vfs_cache_pressure=100 the kernel will attempt
to reclaim dentries and inodes at a “fair” rate with respect to
pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes
the kernel to prefer to retain dentry and inode caches. When
vfs_cache_pressure=0,the kernel will never reclaim dentries and
inodes due to memory pressure and this can easily lead to
out-of-memory conditions. Increasing vfs_cache_pressure beyond 100
causes the kernel to prefer to reclaim dentries and inodes.
Increasing vfs_cache_pressure significantly beyond 100 may have negative performance impact. Reclaim code needs to take various locks to find freeable directory and inode objects. With vfs_cache_pressure=1000,it will look for ten times more freeable objects than there are.