centos刷缓存


Writing to this will cause the kernel to drop clean caches, as well as
reclaimable slab objects like dentries and inodes. Once dropped, their
memory becomes free.

To free pagecache:
回收页缓存

echo 1 > /proc/sys/vm/drop_caches

To free reclaimable slab objects (includes dentries and inodes):
释放可回收的 slab 对象(包括目录和 inode)

echo 2 > /proc/sys/vm/drop_caches

To free slab objects and pagecache:

echo 3 > /proc/sys/vm/drop_caches

[root@node2 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:          48025       27055       12938         838        8031       19708
Swap:         32767         280       32487
[root@node2 ~]# echo "3" > /proc/sys/vm/drop_caches
[root@node2 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:          48025       27052       20032         838         939       19778
Swap:         32767         280       32487

来源: setting-proc-sys-vm-drop-caches-to-clear-cache)


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: