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

先free 看一下 可用内存是否能装的下swap已用的大小
确定可以后执行swapoff -a && swapon -a 然后free 检查下

最新文章

  1. UIDatePicker
  2. 新浪微博客户端(2)-自定义导航控制器,统一NavigationItem
  3. 【动态规划】Codeforces 698A & 699C Vacations
  4. [javascript]event属性
  5. RabbitMQ 3.6.1集群搭建
  6. linux 3.10 缺页异常(TLB_invalid)通用处理框架
  7. Web Service进阶(六)SOAPBinding绑定方式异常 is not found. Have you run APT to generate them
  8. tvtk管线技术、数据集与数据加载
  9. centos7 ambari2.6.1.5+hdp2.6.4.0 大数据集群安装部署
  10. SpringBoot实用小知识之Maven中dependencys和dependencymanagement区别
  11. Go资源
  12. 脑残式网络编程入门(二):我们在读写Socket时,究竟在读写什么?
  13. mgo mode说明
  14. 转载:ThreadPoolExecutor 源码阅读
  15. Thinkphp5.0整合个推例子
  16. PHP实现简单倒计时
  17. java.awt.headless 模式
  18. zabbix 自定义监控 排除带报错提示
  19. ubuntu安转QTcreator出现The default mkspec symlink is broken
  20. [转]让程序不触发 Vista/Win7下应用程序兼容性助手弹出 .

热门文章

  1. robot framework 如何处理循环条件下面的变量自增
  2. centos+docker+jenkins
  3. 使用node建立本地服务器访问静态文件
  4. 关于http的小知识
  5. switch语句中 参数的类型
  6. SHELL字符串处理技巧(${}、##、%%)
  7. javascript动态添加html节点
  8. 【年度盘点】最受欢迎的5大Java练习项目
  9. PYTHON 爬虫 baidu美女图片
  10. 6. kafka序列化和反序列化