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

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 极限学习机(Extreme Learning Machine)概述

    极限学习机(Extreme Learning Machine)概述摘要当今研究领域的一项事实就是,前向神经网络(feed-forwardneuralnetworks)的训练速度比人们所期望的速度要慢很多。并且,在过去的几十年中,前向神经网络在应用领域存在着很大的

  • PHP个人博客系统开发历程

    PHP个人博客系统开发历程

    2021年11月14日
  • 华为光纤交换机zone配置

    华为光纤交换机zone配置需求:划分2个zone,接入两个不同业务群集。环境:华为光纤交换机SNS2124IOIO:串口,只用于串口登录admin/Hawei12#$有网络图标的口:管理口,管理地址10.77.77.77,http://10.77.77.77admin/Hawei12#$,连接网线可通过ssh登录。使用ipaddrset命令修改地址。注意:按照第一步至第六步即可完成配置,如修过别名或zone成…

  • 混合开发hybrid原理_unity引擎开源吗

    混合开发hybrid原理_unity引擎开源吗首先,我们先来罗列一下当前市面上,移动端的各种开发方法1.NativeApp纯原生的app开发模式,android(Java)或者ios(Swift,Oc)优点:有最好的性能,有最好的体验缺点:开发和发布的成本极高,两端需要不同的技术人员来维护,原生开发人员非常的稀缺2.WebApp移动端运行在浏览器上的网站,我们一般称之为H5应用,就是泛指我们经常开发的spa,map页面语言:js,vue,react,angular等优点:1.开发和发布非常方便2.用户看到的页面,会随着开发人

  • 爱因斯坦题目谁养鱼_爱因斯坦的问题有哪些

    爱因斯坦题目谁养鱼_爱因斯坦的问题有哪些在一条街上,有5座房子,喷了5种颜色,每个房里住着不同国籍的人,每个人喝不同的饮料,抽不同的香烟,养不同的宠物。请问,谁养鱼?

  • Java安全之Commons Collections5分析

    Java安全之CommonsCollections5分析文章首发:Java安全之CommonsCollections5分析0x00前言在后面的几条CC链中,如果和前面的链构造都是基本一样的

    2021年12月12日

发表回复

您的电子邮箱地址不会被公开。

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