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
Why use swap when there is more than enough RAM.的更多相关文章
- How To Add Swap on Ubuntu 14.04
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04 How To Add Swap on ...
- Ubuntu swap
问:我是一个Ubuntu 14.04 LTS版本的新手.我需要一块额外的swap文件来提高我Ubuntu服务器的性能.我怎样才能通过SSH连接用相关命令为我的Ubuntu 14.04 LTS 增加一块 ...
- How To Add Swap Space on Ubuntu 16.04
Introduction One of the easiest way of increasing the responsiveness of your server and guarding aga ...
- Linux swap分区操作
swap交换分区是系统RAM的补充,swap 分区支持虚拟内存.当没有足够的 RAM 保存系统处理的数据时,会将数据写入 swap 分区,当系统缺乏 swap 空间时,内核会因 RAM 内存耗尽而终止 ...
- Linux监控工具介绍系列——vmstat
说来惭愧,玩Linux这么久了,居然没有玩转vmstat这个命令,对很多指标的具体意义都有点模糊不清,花了点时间好好学习.整理一下这个命令的相关资料.因为这个命令确实比较重要,而且频繁用到. 命令 ...
- Linux监控工具介绍系列——free
在Linux系统中,我们查看.监控系统内存使用情况,一般最常用的命令就是free.free命令其实非常简单,参数也非常简单,但是里面很多知识点未必你都掌握了.下面总结一下我所了解的free命令.如有不 ...
- Linux 下 Oracle 内核参数优化
数据库的性能优化涉及到整个数据库运行环境的方方面面,诸如操作系统,Oracle自身,存储,网络等等几个大块.而操作系统则是Oracle稳定运行与最大化性能的基石.本文主要描述基于Linux系统下 Or ...
- windows平台下redis安装及配置文件介绍
1.redis介绍 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(s ...
- PostgreSQL Hardware Performance Tuning
Bruce Momjian POSTGRESQL is an object-relational database developed on the Internet by a group of de ...
随机推荐
- linux高频操作: host,用户管理,免密登陆,管道,文件权限,脚本,防火墙,查找
1. 修改hosts和hostname 2. 用户管理 3. 免秘登陆 4. 文件末尾添加 >> 5. 设置可执行文件 6. 任何地方调用 7. Centos6 永久关闭防火墙 8. Ce ...
- python——操作系统的发展史
一.手工操作 —— 穿孔卡片 1946年第一台计算机诞生--20世纪50年代中期,计算机工作还在采用手工操作方式.此时还没有操作系统的概念. 程序员将对应于程序和数据的已穿孔的纸带(或卡片)装入 ...
- webdispatch配置
PRDPISP01:/sapmnt/WIP/profile # su - wipadm PRDPISP01:wipadm 23> cdpro PRDPISP01:wipadm 24> ls ...
- Django之form表单详解
构建一个表单 假设你想在你的网站上创建一个简单的表单,以获得用户的名字.你需要类似这样的模板: <form action="/your-name/" method=" ...
- php 图片与base64互转
header('Content-type:text/html;charset=utf-8'); //读取图片文件,转换成base64编码格式 $image_file = '1.png'; $image ...
- Python_for语句
1.for语句: myuser={ 'id':1, 'name':'张三', '语文':98, '数学':99, '英语':40 } for key in myuser: print('学生的'+ke ...
- vi编辑器简介
vi编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界面,vi是效率很高的文本编辑器.尽管在Linux上也有很多图形界面的编辑器可用,但vi在系统和服务器管理中的功能 ...
- Mongodb创建用户Error: couldn’t add user: Use of SCRAM-SHA-256 requires undigested passwords
解决方案:修改mechanisms加密方式为SCRAM-SHA-1 db.createUser({ user: "admin", pwd: "xxx", rol ...
- ElasticSearch 连载一 基础入门
ElasticSearch简写ES,ES是一个高扩展.开源的全文检索和分析引擎,它可以准实时地快速存储.搜索.分析海量的数据. 应用场景 我们常见的商城商品的搜索 日志分析系统(ELK) 基于大量数据 ...
- Nginx练习练习玩玩
Date:2019-11-9 读前思考: 对于NGINX,一般会问什么? 面试官会从哪方面入手? 面试官到底想考察什么? 你做好准备了吗? 如果对于初学者,往往可以通过面试题来提升对某一个技术的了解和 ...