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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • sublime4 激活码2021【2021.8最新】

    (sublime4 激活码2021)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html83PVI25FMO-eyJsaWNlbnNlSW…

    2022年3月27日
    81
  • python进阶(6)深拷贝和浅拷贝[通俗易懂]

    python进阶(6)深拷贝和浅拷贝[通俗易懂]深拷贝和浅拷贝不管对于浅拷贝、还是深拷贝,针对不可变对象str、int、tuple(有点特殊)、boolean,它的内存地址是不变的,拷贝的仅仅是值importcopya=1b=co

    2022年7月30日
    9
  • 运用NDWI指数对高分1号进行水体提取–以matlab为例

    运用NDWI指数对高分1号进行水体提取–以matlab为例clcclearpath1=’D:\…\GF1_PMS2_E116.7_N40.2_20130501_L1A0000152355-MSS2.tiff’;image=imread(path1);R=image(:,:,1);G=image(:,:,2);B=image(:,:,3);Nir=image(:,:,4);[row,column,band]=size(image);N=

    2025年6月5日
    3
  • java编程中开头public是什么意思?

    java编程中开头public是什么意思?public关键字是和访问权限相关的,它所修饰的方法对所有类都是可以访问的Java中的访问权限共有四种,它们的作用范围如下图所示:注释:public里的所有类包括:在不同包内也可以访问。default访问权限又叫包访问权限:在这种权限下,可以访问在同一个包中的其他类的成员。…

    2022年7月9日
    26
  • LoadRunner教程(16)-LoadRunner SLA分析「建议收藏」

    LoadRunner教程(16)-LoadRunner SLA分析「建议收藏」SLA(servicelevelagreement,服务水平协议)可在性能测试过程中,定义性能测试的目标和度量性能,在性能测试过程中LR会收集和保存性能的相关数据,在分析运行结果时,分析器分将收集的数据与SLA中定义的度量数据进行比较,并将分析结果显示在分析器中,SLA三种状态分别是:a.pass:表示SLA获得该项测试数据,并且该数据达到目标要求;b.fail:表示SLA获得该项测试数据,但…

    2022年5月20日
    38

发表回复

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

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