爱生活,爱分享


Centos7 cache/buff过高处理方法

haiten 2020-03-15 522浏览 0条评论
首页/正文
分享到: / / / /

当linux运行久点,会产生很多不必要的cache或者buff,导致占用太多的内存,其实这可以手动去释放它。

[root@DD-Server-9F ~]# free
              total        used        free      shared  buff/cache   available
Mem:        8073628     1374360     2004964      385620     4694304     5820840
Swap:       8388604           0     8388604
[root@DD-Server-9F ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.7G        1.3G        1.9G        376M        4.5G        5.6G
Swap:          8.0G          0B        8.0G
#加入以下3条命令去释放cache/buff
[root@DD-Server-9F ~]# echo 1 > /proc/sys/vm/drop_caches
[root@DD-Server-9F ~]# echo 2 > /proc/sys/vm/drop_caches
[root@DD-Server-9F ~]# echo 3 > /proc/sys/vm/drop_caches
[root@DD-Server-9F ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.7G        1.3G        6.0G        376M        479M        5.8G
Swap:          8.0G          0B        8.0G

如果想自动释放,可以加入crontab计划任务处理,或者写个自动化脚本去执行,效果会更显著。

原文链接:Centos7 cache/buff过高处理方法

作者:kevinxliu

其它备用学习参考:

Linux 性能优化笔记:内存中的Buffer和Cache

Linux中Buffer和Cache的区别

Linux中Cache内存占用过高解决办法

转载仅为方便学习查看,一切权利属于原作者,本人只是做了整理和排版,如果带来不便请联系我删除。

最后修改:2020-03-15 16:17:28 © 著作权归作者所有
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付

上一篇

发表评论

说点什么吧~

评论列表

还没有人评论哦~赶快抢占沙发吧~