调整inode缓存的linux缓存设置

前端之家收集整理的这篇文章主要介绍了调整inode缓存的linux缓存设置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在处理文件系统中的一亿个文件(分布在很多子目录中),我需要能够非常快速地列出它们,特别是为了有效地进行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.

猜你在找的Linux相关文章