linux mysql 清空缓存吗_linux 缓存手动清除

本文介绍了如何在Linux系统中通过/proc/sys/vm/drop_caches文件来清空缓存,包括页缓存、dentries和inodes。详细解释了不同数值对缓存的影响,并建议在执行此操作前先运行sync命令。同时,讨论了Linux内存分配方式,解释了服务器内存使用情况和free命令的输出解析。
摘要由CSDN通过智能技术生成

说明:

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

0 – 不释放

1 – 释放页缓存

2 – 释放dentries和inodes

3 – 释放所有缓存

数字1是用来清空最近放问过的文件页面缓存

数字2是用来清空文件节点缓存和目录项缓存

数字3是用来清空1和2所有内容的缓存。

2>. 关于drop_caches的官方说明如下:

Writing to this file causes the kernel to drop clean caches,dentries and inodes from memory, causing that memory to becomefree.

To free pagecache, use echo 1 > /proc/sys/vm/drop_caches;

to freedentriesandinodes, 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.

3>. Linux内核会将它最近访问过的文件页面缓存在内存中一段时间,这个文件缓存被称为pagecache。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值