RedHat Enterprise Linux 中的 vm.swappiness

RedHat Enterprise Linux 中的 vm.swappiness

我并不经常发帖,所以如果我的礼仪不好,请提前道歉。

我被指示添加vm.swappiness=0/etc/sysctl.conf。

当我查看该文件的内容时,我看到了下面的注释。我不清楚我是否应该将其附加vm.swappiness=0到文件底部,或者是否需要将其放在注释引用的其他文件之一中:

# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).```

答案1

在带有 systemd 的 Linux 上,/etc/sysctl.d/*.conf是特定于站点的目录,也是系统管理员进行调整的好地方。请参阅评论中引用的手册页。

放入目录更易于管理,每组调优都可以作为文件安装。确保文件中存在某一特定行并非易事,很难实现自动化。

创建 /etc/sysctl.d/vm.conf包含以下行的文件vm.swappiness=1

swappiness 为 1,因为如果存在交换空间,则应使用它。如果系统永不交换,则删除分页空间。

为了完整起见,请注意 tuned 是一个单独的性能配置文件,可以调整 sysctl。不过,你不太可能使用它。

相关内容