微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我们在生产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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐