oscache远程服务器特别卡,top命令查看获得 buff/cache 占据内存特别大,使用以下命令清理缓存:
swap清理:
swapoff -a && swapon -a
注意:这样清理有个前提条件,空闲的内存必须比已经使用的swap空间大
cache清理:
sync; sync; sync;&& echo 3 > /proc/sys/vm/drop_caches
sleep 2
echo 0 >/proc/sys/vm/drop_caches
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
/proc/sys/vm/drop_caches 的值默认为0(所以我们清空后,还再恢复它的值为0)