4 ms·
Can you not protect processes from the oomkiller? This is trivial and very useful on FreeBSD https://www.freebsd.org/cgi/man.cgi?query=protect&sektion=1 https:
by feld 10y ago
Can you not protect processes from the oomkiller? This is trivial and very useful on FreeBSD
https://www.freebsd.org/cgi/man.cgi?query=protect&sektion=1 https://www.freebsd.org/cgi/man.cgi?query=protect&sektion=1
- mwpmaybe 10y agoYes, with oom_score_adj[0], which I've mentioned several times. Setting it to -1000 for a process protects it from OOM killing. 0. http://man7.org/linux/man-pages/man5/proc.5.html http://man7.org/linux/man-pages/man5/proc.5.html
- feld 10y agothat looks painful to use. Do Linux distros let you automatically protect services? E.g. On FreeBSD: mysql_enable="YES" mysql_oomprotect="YES" Now every time you start the MySQL service it's automatically protected
- viraptor 10y agoDefine "automatically" and "services" first ;-) Normally you just set it in the systemd's unit file for each daemon you want to adjust. So for some definitions of the above the answer is yes. (OOMScoreAdjust in https://www.freedesktop.org/software/systemd/man/systemd.exec.html https://www.freedesktop.org/software/systemd/man/systemd.exe...)
- JdeBP 10y agoPersonally, I use one tool for both FreeBSD and Linux. Picking up the (imported) rc.conf variable for a service is a mere matter of oom-kill-protect fromenv And the conversion from something like OOMScoreAdjust is quite straightforward. A PostgreSQL systemd unit file that read OOMScoreAdjust=-625 becomes a run program that contains oom-kill-protect -- -625 * http://marc.info/?l=freebsd-hackers&m=145425153624976&w=2 http://marc.info/?l=freebsd-hackers&m=145425153624976&w=2 * http://jdebp.eu./Softwares/nosh/guide/oom-kill-protect.html http://jdebp.eu./Softwares/nosh/guide/oom-kill-protect.html
- feld 10y agoCool, thanks for sharing. I would hate to have to muck around in /proc manually to set this.