加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

调整inode缓存的linux缓存设置

发布时间:2020-12-14 03:06:58 所属栏目:Linux 来源:网络整理
导读:我正在处理文件系统中的一亿个文件(分布在很多子目录中),我需要能够非常快速地列出它们,特别是为了有效地进行rsync. 另一方面,我并不需要将文件的实际内容保存在缓存中. 我不断添加和删除文件,但不经常(每秒十次). 有没有办法告诉操作系统(2.6.18-194.el5)在
我正在处理文件系统中的一亿个文件(分布在很多子目录中),我需要能够非常快速地列出它们,特别是为了有效地进行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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读