linux swappiness相关知识
来源:互联网 发布:男生油性皮肤知乎 编辑:程序博客网 时间:2024/05/18 01:33
from :http://www.cnblogs.com/billyxp/archive/2013/01/25/2877076.html
最近工作中频繁遇到swap引发的问题,记得曾经读过当内存比较大的时候可以将swappiness调整成0。下面整理一下swappiness相关的知识。
1、什么是swap
Swap空间的作用可简单描述为:当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临时保存到Swap空间中,等到那些程序要运行时,再从Swap中恢复保存的数据到内存中。这样,系统总是在物理内存不够时,才进行Swap交换。
2、swappiness干什么用
swappiness是控制系统使用swap分区的频率阀值,当swappiness=100的时候,系统会积极使用swap分区,而当swappiness=0的时候系统最大限度的有限使用物理内存。
Swappiness is a property for the Linux kernel that changes the balance between swapping out runtime memory, as opposed to dropping pages from the system page cache. Swappiness can be set to values between 0 and 100 inclusive. A low value means the kernel will try to avoid swapping as much as possible where a higher value instead will make the kernel aggressively try to use swap space. The default value is 60, and for most desktop systems, setting it to 100 may affect the overall performance, whereas setting it lower (even 0) may improve interactivity (decreasing response latency.)[1]In short:vm.swappiness = 0 - it will swap only to avoid an out of memory conditionvm.swappiness = 60 - default valuevm.swappiness = 100 - it will swap aggressvelyTo temporarily set the swappiness in Linux, as root you set the value to 100 with the following command: echo 100 > /proc/sys/vm/swappinessPermanent changes are made in /etc/sysctl.conf via the following configuration line (inserted if not present previously): vm.swappiness = 100
3、如何修改swappiness
查看
cat /proc/sys/vm/swappiness
修改
sysctl vm.swappiness=10
永久修改
echo "0" >> /etc/sysctl.conf
- linux swappiness相关知识
- 【linux】 swap swappiness相关
- linux系统swappiness swap修改
- Linux 硬盘相关知识
- Linux PS1相关知识
- Linux inode相关知识
- Linux库相关知识
- linux tc 相关知识
- linux cpufeq相关知识
- linux 相关知识总结
- linux 相关知识总结
- Linux 相关知识
- Linux相关知识总结
- linux cpufeq相关知识
- Linux mutex相关知识
- linux相关知识
- Linux相关知识
- 嵌入式linux相关知识
- 外部中断(按键1)
- Android开发:定制自己的Camera
- 把Javadoc转换成CHM格式的帮助文档
- MongoDB学习笔记(五) MongoDB文件存取操作
- 73. 抵制单件模式的诱惑
- linux swappiness相关知识
- CvArr、Mat、CvMat、IplImage、BYTE转换(总结而来)
- NYOJ 205 求余数
- MongoDB学习笔记(六) MongoDB索引用法和效率分析
- 工厂模式--java
- 【程序语言】C/C++中如何使用Lua脚本
- Effective Objective-C 2.0: Method Swizzling to Debug Opaque Methods
- 一些有用的链接
- android 处理图片工具