Linux下清理内存和Cache方法 /proc/sys/vm/drop_caches
频繁的文件访问会导致系统的Cache使用量大增
$ free -m
total used free shared buffers cached
Mem:
-/+ buffers/cache:
Swap:
free内存减少到几十兆,系统运行缓慢
运行sync将dirty的内容写回硬盘
$sync
通过修改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 > /proc/sys/vm/drop_caches
To free dentries and inodes:
* echo > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
* echo > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are notfreeable, the user should run "sync" first in order to make sure allcached objects are freed.
This tunable was added in 2.6..
修改/etc/sysctl.conf 添加如下选项后就不会内存持续增加
vm.dirty_ratio =
vm.dirty_background_ratio=
vm.dirty_writeback_centisecs=
vm.dirty_expire_centisecs=
vm.drop_caches=
vm.swappiness =
vm.vfs_cache_pressure=
vm.overcommit_memory=
vm.lowmem_reserve_ratio=
kern.maxvnodes=
上面的设置比较粗暴,使cache的作用基本无法发挥。需要根据机器的状况进行适当的调节寻找最佳的折衷。
Linux下清理内存和Cache方法
暂时目前的环境处理方法比较简单: 在root用户下添加计划任务: */10 * * * * sync;echo 3 > /proc/sys/vm/drop_caches; 每十分钟执行一次,先将 ...
Linux下清理内存和Cache方法见下文:
暂时目前的环境处理方法比较简单: 在root用户下添加计划任务: */10 * * * * sync;echo 3 > /proc/sys/vm/drop_caches; 每十分钟执行一次,先将 ...
Linux/Centos下清理内存和Cache方法
Linux/Centos下释放内存和缓存方法 $ free -m 运行sync将dirty的内容写回硬盘$ sync 通过修改proc系统的drop_caches清理free的cache$ echo ...
/proc/sys/vm/drop_caches 清理缓存
1. 使用方法 /proc/sys/vm/drop_caches默认是0 # echo 1 > /proc/sys/vm/drop_caches; free pagecache, use# ec ...
linux内存——/proc/sys/vm/drop_caches
原贴:http://www.linuxfly.org/post/320/ http://blog.csdn.net/chinalinuxzend/article/category/265273/2 ...
手工释放linux内存——/proc/sys/vm/drop_caches
--手工释放linux内存——/proc/sys/vm/drop_caches 总有很多朋友对于Linux的内存管理有疑问,之前一篇日志似乎也没能清除大家的疑虑.而在新版核心中,似乎对这个问题提供了新 ...
[转]手工释放linux内存——/proc/sys/vm/drop_caches
另一篇:http://www.linuxfly.org/post/320/ 1.清理前内存使用情况 free -m 2.开始清理 echo 1 > /proc/sys/vm/drop_ca ...
Linux下查看内存使用情况方法总结
Linux查看CPU和内存使用情况:http://www.cnblogs.com/xd502djj/archive/2011/03/01/1968041.html 在做Linux系统优化的时候,物理内 ...
随机推荐
HL AsySocket 服务开发框架 - 业务逻辑层
一 概述 Socket服务只是提供一个网络传输服务. 业务逻辑层在整体架构中的位置在那里呢,如图: 网络层将解包后的消息包抛至业务逻辑层,业务逻辑层收到消息包后,解析消息类型,然后转入相应的处理流程处 ...
mybatis06 增删改差 源码
user.java package cn.itcast.mybatis.po; import java.util.Date; public class User { private int id; p ...
php 中的魔术方法-----“事件方法”
来源:http://lornajane.net/posts/2012/phps-magic-__invoke-method-and-the-callable-typehint php 中的这个对象 , ...
(五)Jquery Mobile列表
Jquery Mobile列表 一.JM列表 1.普通列表 效果: 带序号的列表 将ul换成ol 效果: 2.data-inset=& ...
oop6 栈 界面
作业要求 本次作业要求实现核心算法,请将表达式生成的代码及相关的检验.计算表达式结果的代码贴在博客中,并对代码进行必要的解释. 发表一篇博客,博客内容为:提供本次作业的github链接,本次程序运行的 ...
C#下的两种加密方式MD5和DEC
md5加密 /// /// MD5加密 /// ///