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


相关推荐

  • charles乱码怎么解决_如何防止charles抓包

    charles乱码怎么解决_如何防止charles抓包前言当使用Charles抓包时,发现数据都是乱码,这时需要安装证书解决办法1.点击charles窗口,点击左上角Help->SSLProxying→InstallCharles

    2022年7月31日
    3
  • 指针指向常量_常量指针的四种

    指针指向常量_常量指针的四种const关键字指针常量和常量指针都离不开const关键字,我们先来了解一下什么是const关键字,const被用来定义常量,如果将一个变量加上const关键字,则被修饰的变量的值将无法改变。这个变量的值只能被访问,无法被修改。const关键字可以修饰变量或者指针。下面是const修饰变量的用法:constinta=6;或者intconsta=6;此时变量a…

    2022年10月20日
    0
  • 十大经典排序算法+sort排序

    十大经典排序算法+sort排序本文转自:"十大经典排序算法",其中有动图+代码详解,本文简单介绍+个人理解。排序算法经典的算法问题,也是面试过程中经常被问到的问题。排序算法简单分类如下:这些排序算法的

    2022年7月4日
    19
  • python getopt方法_python的getopt

    python getopt方法_python的getopt1、简介所有UNIX程序甚至那些具有图形用户界面(GraphicalUserInterface,GUI)的程序,都能接受和处理命令行选项。对于某些程序,这是与其他程序或用户进行交互的主要手段。具有可靠的复杂命令行参数处理机制,会使得您的应用程序更好、更好用。Getopt是一个专门设计来减轻命令行处理负担的库函数,主要用来分析命令行参数,不仅python语言中有getopt,C语言中也有geto…

    2022年6月6日
    30
  • 硬件设计——外围电路(电源电路)[通俗易懂]

    硬件设计——外围电路(电源电路)[通俗易懂]引言 当我们设计一个完整的电路而言,我们除了要知道我们要设计的主芯片电路,如FPGA,DSP,还要知道一些外围电路,如电源电路,复位电路、晶振电路等等。这篇文章我们先来讲解一下对于如何设计一个电源电路。 正文 首先我们查询主芯片的datesheet,根据datesheet,可知主芯片采用多大的电压才能正常工作,然后我们根据其设计电源电路。每个电子设备都有一个供给能量的电源电路。电源电路有整流电源、逆变电源和变频器三种。常见的家用电器中多数要用到直流电源。直流电源的最简单的供电方法是用电池。..

    2022年5月6日
    69
  • vs2008中英文版下载-VS2008注册码序列号–vs2008激活成功教程方法[通俗易懂]

    vs2008中英文版下载-VS2008注册码序列号–vs2008激活成功教程方法[通俗易懂]vs2008中英文版下载-VS2008注册码序列号–vs2008激活成功教程方法一、VisualStudio2008TeamSuite(90天试用版)下载地址:1.VS2008英文版3.83GBISO文件http://download.microsoft.com/download/d/8/9/d89c9839-ac45-4a6c-b25f-2f60b190e356/VS20

    2022年8月10日
    5

发表回复

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

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