由于在运行几天后大量使用交换,我正在对一台机器进行故障排除。系统有 16 GB 的 ram,一般应该没问题,除了大量的 ram 被缓存使用而不是在需要时释放。持续使用会使系统陷入停顿,而缓存中会占用多达 12 GB 的空间。
在你提到它之前,我很清楚Linux Ate My Ram。
运行 3 - 4 天后免费的典型显示是:
total used free shared buff/cache available
Mem: 15G 4.4G 184M 280M 10G 116M
Swap: 15G 7.8G 8.1G
Run Code Online (Sandbox Code Playgroud)
为了排除故障,我已将交换率降至零。
$ cat /proc/sys/vm/swappiness
0
Run Code Online (Sandbox Code Playgroud)
此外,我无法手动调用具有任何有意义效果的缓存刷新。
$ sudo su -c "free -h && sync && echo 3 > /proc/sys/vm/drop_caches && free -h"
total used free shared buff/cache available
Mem: 15G 4.4G 166M 280M 10G 104M
Swap: 15G 7.8G 8.1G
total used free …
Run Code Online (Sandbox Code Playgroud)