相关疑难解决方法(0)

为什么swappiness不起作用?

我们有一台 RHEL 7 机器,只有 2G 的可用内存:

free -g
              total        used        free      shared  buff/cache   available
Mem:             31          28           0           0           1           2
Swap:            15           9           5
Run Code Online (Sandbox Code Playgroud)

所以我们决定用vm.swappiness = 100in/etc/sysctl.conf而不是 10将swappiness 增加到最大值,并用于sysctl -p应用设置。

一段时间后,我们再次检查状态:

 free -g
              total        used        free      shared  buff/cache   available
Mem:             31          28           0           0           2           2
Swap:            15           9           5
Run Code Online (Sandbox Code Playgroud)

正如我们所看到的,尽管有新的 swappiness 设置,但我们看到free -g可用 RAM 保持在 2G。为什么?这里有什么问题?

我们预计会看到 15G 的已交换。

我们还检查了:

cat /proc/sys/vm/swappiness
100
Run Code Online (Sandbox Code Playgroud)

所以一切都应该根据新设置工作,但free显示相同的情况。这是怎么回事?

linux rhel memory swap free

3
推荐指数
1
解决办法
2439
查看次数

标签 统计

free ×1

linux ×1

memory ×1

rhel ×1

swap ×1