(转)Linux下清理Cache方法
2016-02-14 11:25
519 查看
频繁的文件访问会导致系统的Cache使用量大增, 系统运行缓慢。
1 首先用free 命令查看内存的使用:
$ free -m
total used free shared buffers cached
Mem: 3955 3926 28 0 55 3459
2 运行sync将dirty的内容写回硬盘
$sync
3 通过修改proc系统的drop_caches清理free的cache
$echo 3 > /proc/sys/vm/drop_caches
关于drop_caches的详细文档如下:
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
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
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
参考文献:
[1] 转载地址:
http://blog.chinaunix.net/uid-25505925-id-180921.html
http://m.blog.csdn.net/article/details?id=4336075.
1 首先用free 命令查看内存的使用:
$ free -m
total used free shared buffers cached
Mem: 3955 3926 28 0 55 3459
2 运行sync将dirty的内容写回硬盘
$sync
3 通过修改proc系统的drop_caches清理free的cache
$echo 3 > /proc/sys/vm/drop_caches
关于drop_caches的详细文档如下:
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
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
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
参考文献:
[1] 转载地址:
http://blog.chinaunix.net/uid-25505925-id-180921.html
http://m.blog.csdn.net/article/details?id=4336075.
相关文章推荐
- Linux源码打包工具CheckInstall
- Linux ALSA声卡驱动之四:Control设备的创建
- 阿里云服务器CentOS 6.3下快速安装部署 LAMP 、vsftpd 环境的方法
- linux系统常用监控工具
- linux网桥配置brctl
- Linux一些命令
- Linux od命令(以指定进制显示文件)
- centos6.5 设置固定ip
- Centos 升级python2.7到python3.4.2
- 如何用十条命令在一分钟内检查Linux服务器性能
- linux运维实战练习-2016年1月19日-2月3日课程作业(练习)
- 完美解决 Linux 下 Sublime Text 中文输入
- Linux系统编程基础知识 2015/1/14
- Linux进程管理
- 【备忘】Linux Samba 简易设置
- PHP执行linux命令的6个函数
- LINUX版本的MYSQL大小写忽略处理
- 【No.1】监控Linux性能25个命令行工具
- linux 监控系统剩余内存大小
- Linux相关书籍下载