File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ icon: material/bug
68
68
69
69
oomd 是 opt-in 的——需要主动在 systemd 相关 unit 中添加相关配置,oomd 才会处理。可以使用 `oomctl` 命令获取当前 oomd 状态,检查 "Swap Monitored CGroups" 与 "Memory Pressure Monitored CGroups" 是否包含需要监控的 systemd unit。诸如 Debian、Fedora 等发行版均做了相关的预配置。
70
70
71
+ 除了在 unit 文件中配置 `ManagedOOMSwap` 和 `ManagedOOMMemoryPressure` 外,建议通过编辑 `/etc/systemd/oomd.conf` 文件来调整 oomd 的全局行为。其中 `SwapUsedLimit` 参数(默认为 90%)虽然名称中包含 "Swap",但它同时适用于物理内存和 Swap 空间。oomd 触发的条件是:内存压力(PSI)超过 `OOMMemoryPressureLimit` **或** (物理内存使用率 > `SwapUsedLimit` **且** Swap 空间使用率 > `SwapUsedLimit`)。在物理内存较大的服务器上,默认的 90% `SwapUsedLimit` 可能过早触发 OOM Killer,影响正常使用。此时可以考虑将其调整至更高的值,例如 95% 或 98%,根据实际物理内存大小预留一部分即可。
72
+
71
73
??? example "Debian 12 中的 systemd-oomd 配置"
72
74
73
75
Debian 12 的默认配置为:在用户 slice 下,如果内存压力超过 50%,则杀死压力最大的 cgroup;如果全系统 swap 使用率超过默认值(90%),则杀死占用最大的 cgroup。
You can’t perform that action at this time.
0 commit comments