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

linux – 在读取文件时,我可以让tar不使用文件系统缓存吗?

发布时间:2020-12-13 17:01:14 所属栏目:Linux 来源:网络整理
导读:我们在生产Web服务器上有一个cronned作业,需要从文件系统中获取文件.它运行大约105分钟,在此期间,Apache开始交换,因为所有读取一些文件已经扩展了文件系统缓存的内存量. tar正在读取的数据不需要存在于文件系统缓存中.它进入tarfile就是这样.有什么东西我们
我们在生产Web服务器上有一个cronned作业,需要从文件系统中获取文件.它运行大约105分钟,在此期间,Apache开始交换,因为所有读取一些文件已经扩展了文件系统缓存的内存量.

tar正在读取的数据不需要存在于文件系统缓存中.它进入tarfile就是这样.有什么东西我们可以说像tar cvf无论/ –no-system-file-buffer-reads?我对男人tar的阅读并没有出现任何看起来会有所帮助的东西.

你不必指出这可以被视为“Doc,当我这样做时会很痛!所以不要那样”的情况.不知何故,我们需要将文件转储到tar文件中,所以不是那样的选择.

解决方法

我想这已经回答了 here:

There is the 07001 utility,which can prepended to a command like
ionice and nice. It works by preloading a library which adds
posix_fadvise with the POSIX_FADV_DONTNEED flag to any open calls.

In simple terms,it advises the kernel that caching is not needed for
that particular file; the kernel will then normally not cache the
file. See 07002 for the technical details.

It does wonders for any huge copy jobs,e. g. if you want to backup a
multi terabyte disk in the background with the least possible impact
on you running system,you can do something along nice -n19 ionice -c3 nocache cp -a /vol /vol2.

(编辑:李大同)

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

    推荐文章
      热点阅读