Why use swap when there is more than enough RAM.
Swappiness is a property of 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 (by decreasing response latency.)
In short:
Value | Strategy |
---|---|
vm.swappiness = 0 |
The kernel will swap only to avoid an out of memory condition. |
vm.swappiness = 60 |
The default value. |
vm.swappiness = 100 |
The kernel will swap aggressively which may affect over all performance. |
To temporarily set the swappiness in Linux, write the desired value (e.g. 10
) to /proc/sys/vm/swappiness
using the following command, running as root user:
# Set the swappiness value as root
echo 10 > /proc/sys/vm/swappiness
# Alternatively, run this as a non-root user
sudo sysctl -w vm.swappiness=10
# Verify the change
cat /proc/sys/vm/swappiness
10
Permanent changes are made in /etc/sysctl.conf
via the following configuration line (inserted if not present previously):
vm.swappiness = 10
释放swap
最新文章
- UIDatePicker
- 新浪微博客户端(2)-自定义导航控制器,统一NavigationItem
- 【动态规划】Codeforces 698A &; 699C Vacations
- [javascript]event属性
- RabbitMQ 3.6.1集群搭建
- linux 3.10 缺页异常(TLB_invalid)通用处理框架
- Web Service进阶(六)SOAPBinding绑定方式异常 is not found. Have you run APT to generate them
- tvtk管线技术、数据集与数据加载
- centos7 ambari2.6.1.5+hdp2.6.4.0 大数据集群安装部署
- SpringBoot实用小知识之Maven中dependencys和dependencymanagement区别
- Go资源
- 脑残式网络编程入门(二):我们在读写Socket时,究竟在读写什么?
- mgo mode说明
- 转载:ThreadPoolExecutor 源码阅读
- Thinkphp5.0整合个推例子
- PHP实现简单倒计时
- java.awt.headless 模式
- zabbix 自定义监控 排除带报错提示
- ubuntu安转QTcreator出现The default mkspec symlink is broken
- [转]让程序不触发 Vista/Win7下应用程序兼容性助手弹出 .