关闭Linux缓存

来源:互联网 发布:网御数据库审计 编辑:程序博客网 时间:2024/05/13 10:58
Sometimes, we have such a situation happening with droping the OS cache. We may usually tell the OS to use direct io or unbuffered reads and writes. How to drop the OS caches?

To use /proc/sys/vm/drop_caches, just echo a number to it.

To free pagecache:
# echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:
# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. 


0 0
原创粉丝点击