Dirty deeds done dirt cheap_centos 8 stratis

Dirty deeds done dirt cheap_centos 8 stratis文章目录[隐藏]TweakSwaponCentOS7TweakSwaponCentOS7Swapisquiteimportantonasmallvirtualmachinebutalsoonlargeservers.Ifyouhaven’tenabledSwapyetyoushouldcheckthefollowingguideh…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

文章目录 [隐藏]

Tweak Swap on CentOS 7

Swap is quite important on a small virtual machine but also on large servers. If you haven’t enabled Swap yet you should check the following guide here. This article should provide you some information about swap and how you can tweak swap on CentOS 7.

Pre-flight checks

We’ll check if swap is enabled using swapon -s which should output something similar to this:

[root@web ~]# swapon -s

FilenameTypeSizeUsedPriority

/swap file104857216-1

This means we currently have a 1GB swap and we can confirm that it’s enabled by running free -m.

We’ll be touching two variables here: Swappiness and Cache Pressure.

Swappiness

Swappiness is a Linux kernel parameter that controls the relative weight given to swapping out runtime memory, as opposed to dropping pages from the system page cache. This parameter can be set to values from 0 to 100 inclusive. A low value instructs the kernel to avoid swapping, a higher value causes the kernel to try to use swap space as much as possible. The default value is 60 which works on most systems.

vm.swappiness = 0 – The kernel will swap only to avoid running out of memory

vm.swappiness = 60 – The default value

vm.swappiness = 100 – The kernel will swap aggressively, consuming a lot of the disk I/O

If we want a fast machine and we don’t want to hammer disk I/O we’ll need to lower this value. You can check the value for the current setting using cat:

[root@web ~]# cat /proc/sys/vm/swappiness

60

If we want to temporary change this value we can do it using a simple echo:

[root@web ~]# echo 10 > /proc/sys/vm/swappiness

or by using the sysctl tool:

[root@web ~]# sysctl vm.swappiness=10

This setting is not permanent unless we add it to /etc/sysctl.conf. If the value isn’t defined there you can simply add this line at the bottom of the file:

vm.swappiness = 10

After saving the file and exiting the editor the setting is permanent and it should be seen after reboot as well.

Cache Pressure

Another setting the can help your machine to perform better is vfs_cache_pressure. This setting controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.

vfs_cache_pressure = 0 – The kernel will never reclaim dentries and inodes due to memory pressure and this can easily lead to out-of-memory situations

vfs_cache_pressure = 100 – The kernel will attempt to reclaim dentries and inodes at a “fair” rate

vfs_cache_pressure > 100 – The kernel will prefer to reclaim dentries and inodes which is not recommended and can have a bad impact on the machine’s perfromance

Default value on CentOS is 100 and it can be adjusted in the same way as vm.swappiness.

[root@web ~]# sysctl vm.vfs_cache_pressure=50

[root@web ~]# cat /proc/sys/vm/vfs_cache_pressure

50

You can also make it permanent by adding it to /etc/sysctl.conf.

resize,m_fill,w_98,h_98#
Author
marian/
Posted on
January 25, 2015/
Categories
Tutorial/
Tags
CentOS 7,
Swap,
swappiness

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/184616.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 网络号和主机号的计算

    网络号和主机号的计算网络号和主机号的计算当前使用的IP地址有4个字节(32)组成,即IPV4编码方式。每个IP地址包换两部分:网络号和主机号。当分配给主机号的二进制位越多,则能标识的主机数就越多,相应地能标识的网络数就越少,反之亦然。IP地址分为五类,A类保留给政府机构,B类分配给中等规模的公司,C类分配给任何需要的人,D类用于组播,E类用于实验,各类可容纳的地址数目不同。A、B、C三类IP地址的特征:当将IP…

    2022年6月24日
    34
  • 坐标系旋转变换公式图解[通俗易懂]

    坐标系旋转变换公式图解[通俗易懂]而您一旦用以下这图解方法,随时眼见显然,再也不会搞错。平时开发程序,免不了要对图像做各种变换处理。有的时候变换可能比较复杂,比如平移之后又旋转,旋转之后又平移,又缩放。直接用公式计算,不但复杂,而

    2022年8月2日
    7
  • Center OS 7 下的安装Apache「建议收藏」

    Center OS 7 下的安装Apache「建议收藏」使用yum安装,直接yuminstallhttpd

    2022年9月21日
    2
  • 打包的技巧图解(手机软件打包)

    我们打包APP需要用到HBuilder,所以先讲解如何安装使用HBuilder的下载与安装HBuilder的官网下载地址:https://www.dcloud.io/点击DOWNLOAD后会弹出如上显示的两种版本下载Windows版和MacOS版根据我们电脑版本下载即可,我们一定要下载标准版哦(正式版中的)我这里是Windows系统,所以我选择的是window版下载完是一个压缩包右击压缩一下即可打开文件夹后找到如下HBuilderX.exe文件双击即可运行为了方便我们

    2022年4月17日
    64
  • IntelliJ IDEA创建maven web项目(IDEA新手适用)

    IntelliJ IDEA创建maven web项目(IDEA新手适用)PS:从eclipse刚转到IDEA,对于这个陌生的工具我表示无言,但听说很好用,也就试试,结果我几乎花了一晚上的时间才搭起来mavenweb项目,觉得在此给各位一个搭建mavenweb项目的教程,指出我踩过的各种坑!步骤一:首先先创建一个project,在这里就是创建一个maven的工作空间步骤二:按照下面的步骤操作就可以了,最后next首先,选择左边的maven然后在右…

    2022年6月26日
    55
  • Adaboost算法原理分析和实例+代码(简明易懂)

    Adaboost算法原理分析和实例+代码(简明易懂)Adaboost算法原理分析和实例+代码(简明易懂)【尊重原创,转载请注明出处】http://blog.csdn.net/guyuealian/article/details/70995333本人最初了解AdaBoost算法着实是花了几天时间,才明白他的基本原理。也许是自己能力有限吧,很多资料也是看得懵懵懂懂。网上找了一下关于Adaboost算法原理分析,大都是你复制我,我摘…

    2022年6月19日
    28

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号