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


相关推荐

  • c语言中console.writeline(console.writeline())

    C#中Console.WriteLine()的用法

    2022年4月17日
    188
  • java 设置随机数种子_java随机数种子怎么设置[通俗易懂]

    java 设置随机数种子_java随机数种子怎么设置[通俗易懂]java随机数种子怎么设置引导语:Java技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于PC、数据中心、游戏控制台、科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社群。以下是小编整理的java随机数种子怎么设置,欢迎参考阅读!java设置随机数种子教程:一、在j2se里我们可以使用Math.random()方法来产生一个随机数,这个产生的随机数是0-1之间的一个dou…

    2022年7月14日
    20
  • 视图索引问题

    视图索引问题  最近和一直在研究如何加快查询数据库的速度,看了网络上说用索引,会加快查询的速度.我就认真看了索引了一些文章,也建立了表索引.但是在建立视图索引的时候遇到问题了, 无法在视图 SBK_VIEW 上创建 索引,因为该视图未绑定到架购.查一下相关的资料,发现:定义索引视图的  SELECT  语句不得包含视图、行集函数、行内函数或派生表。同一物理表在该语句中只能出现一次

    2022年7月22日
    13
  • matlab单缝衍射强度分布_matlab双缝衍射曲线图

    matlab单缝衍射强度分布_matlab双缝衍射曲线图基于MATLAB单缝衍射?本科毕业论文(设计)题目基于matlab的单缝衍射和双缝干涉可视化模拟学生姓名学号系别物理学与电子信息工程系年级08级专业物理学指导教师职称完成日期闽江学院毕业论文(设计)诚信声明书本人郑重声明:兹提交的毕业论文(设计)《基于matl…

    2022年10月23日
    0
  • Nginx 和 Apache 安装[通俗易懂]

    Nginx 和 Apache 安装[通俗易懂]Nginx和Apache安装Nginx安装Ubuntu下安装CentOS下安装安装依赖下载并解压Nginx创建www用户运行configure文件检测程序编译安装创建软连接在init.d中创建nginx启动Nginx配置防火墙端口Apache安装Ubuntu下安装CentOS下安装安装依赖安装apr安装apr-util安装httpd在init.d中创建软连接启动Nginx安装Ubuntu下安装sudoapt-getinstallnginx–upgr

    2022年5月26日
    34
  • px2rem配置_px和rem转换器

    px2rem配置_px和rem转换器安装px2rem后,再使用px上有些不同,大家可以参考px2rem官方介绍,下面简单介绍一下。直接写px,编译后会直接转化成rem—-除开下面两种情况,其他长度用这个在px后面添加/*no*/,不会转化px,会原样输出。—一般border需用这个在px后面添加/*px*/,会根据dpr的不同,生成三套代码。—-一般字体需用这个 …

    2022年10月23日
    0

发表回复

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

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