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)
blank

相关推荐

  • pycharm无法使用第三方库_python第三方库安装失败

    pycharm无法使用第三方库_python第三方库安装失败前言:在使用pycharm学习python的时候,经常需要第三方库,没有第三方库程序就会报错,pycharm也会提醒你要安装所需要的库,安装第三方库的时候往往就出现了问题,如图;下面我将谈谈一些我遇到的问题及解决经验。1.检查pip是否为最新版本pip不是最新版本时,会直接导致你安装第三方库失败。解决方法:第一,看是否直接在pycharm的setting里面Project下的Projec…

  • 平分石头

    平分石头平分石头题目描述:有一n个石头,它们的重量分别是W1,…,Wn.写一个程序,把它们分成两堆,使得两堆石头的重量差最小。输入格式:输入n(1≤n≤20)表示石头的个数。第二行n个石头的重量W1,…,Wn(1≤Wi≤100000)输出格式:输入最小的差(绝对值)样例输入:5581327…

  • vue的双向绑定原理及实现_vue的数据绑定怎么实现

    vue的双向绑定原理及实现_vue的数据绑定怎么实现vue双向绑定原理浅析1、什么是双向绑定?​ 所谓双向绑定,指的是vue实例中的data与其渲染的DOM元素的内容保持一致,无论谁被改变,另一方会相应的更新为相同的数据。(数据变化更新视图,视图变化更新数据)2、如何实现双向绑定?在vue中可以通过v-model实现双向绑定<template><divid=”app”>{{username}}<br/><inputtype=”text”v-model=”username”&

    2022年10月18日
  • 互联网架构演变

    互联网架构演变互联网架构演变

  • 语义分割的定义_语义分割模型

    语义分割的定义_语义分割模型点击上方“AI算法修炼营”,选择加星标或“置顶”标题以下,全是干货引言语义分割结合了图像分类、目标检测和图像分割,通过一定的方法将图像分割成具有一定语义含义的区域块,并识别出每个区域块的…

  • java分页工具集合「建议收藏」

    java分页工具集合「建议收藏」java分页工具集合说明一、PageHelper(1)pom(2)配置(3)使用正确使用错误使用二、mybatis-plus的分页插件(1)pom(2)配置(3)使用三、自定义工具类(1)创建分页工具类(2)使用说明更新时间:2020/11/617:36,更新完基本内容本文现对目前常见的java分页工具进行一次总结与记录,主要是基于自己的主观来进行总结,本文会持续更新,不断地扩充注意:本文仅为记录学习轨迹,如有侵权,联系删除一、PageHelper这个工具只要是使用过mybatis的人基本都听

发表回复

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

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