DigitalOcean 新推出了一款只有 512 MB 内存的 droplet,然而跑个 dnf upgrade 都能触发 Out of memory: Killed process 10365 (semodule)

ps avxf 可以查看进程的内存占用(RSS)。在搜索资料后我发现以下服务可以优化掉,不过要避免 out of memory 还是建议配置 swap。

droplet-agent

即 The DigitalOcean Droplet Agent,可通过 systemctl 关闭,或用 dnf 完全卸载。

dnf remove droplet-agent

sssd

参考 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_authentication_and_authorization_in_rhel/index 使用以下命令可切换到最小化认证并关闭 sssd 服务。

authselect select minimal
systemctl stop sssd.service
systemctl disable sssd.service

tuned

参考 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/getting-started-with-tuned_monitoring-and-managing-system-status-and-performance 修改 /etc/tuned/tuned-main.conf 配置即可。

daemon = 0

gssproxy

不需要 Kerberos 的话直接卸载也不会有什么问题。 https://github.com/gssapi/gssproxy/blob/main/docs/README.md

dnf remove gssproxy

dnf-makecache

dnf 缓存会定期自动更新,为了保证稳定的内存占用需要禁用掉 dnf-makecache.timer.

systemctl stop dnf-makecache.timer
systemctl disable dnf-makecache.timer

最终效果

# free -h
              total        used        free      shared  buff/cache   available
Mem:          460Mi       103Mi       227Mi       6.0Mi       130Mi       339Mi
Swap:            0B          0B          0B

标签: RHEL

添加新评论