Chinaunix首页 | 论坛 | 博客
  • 博客访问: 199366
  • 博文数量: 34
  • 博客积分: 1572
  • 博客等级: 上尉
  • 技术积分: 911
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-08 15:45
文章分类

全部博文(34)

文章存档

2012年(3)

2011年(31)

我的朋友

分类: LINUX

2011-12-16 16:28:19

今天遇到cache内存耗尽的问题.查了下google发现centos是不主动处理cache

cache1

手动释放方法:

/proc是一个虚拟文件系统,我们可以通过对它的读写操作做为与kernel实体间进行通信的一种手段。也就是说可以通过修改/proc中的文件,来对当前kernel的行为做出调整。那么我们可以通过调整/proc/sys/vm/drop_caches来释放内存

 

echo 1 > /proc/sys/vm/drop_caches

/proc/sys/vm/drop_caches (since Linux 2.6.16)文档
Writing to this file causes the kernel to drop clean caches,
dentries and inodes from memory, causing that memory to become
free.

To free pagecache, use echo 1 > /proc/sys/vm/drop_caches; to
free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 >
/proc/sys/vm/drop_caches.

Because this is a non-destructive operation and dirty objects
are not freeable, the user should run sync first.

基于cache图大致估算是6小时会到在阀值,后续可以做个计划任务去解决

阅读(1704) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~