List:General Discussion« Previous MessageNext Message »
From:Reindl Harald Date:April 13 2012 12:17pm
Subject:FYI: how to prevent mysql from oom-killer
View as plain text  
the following may be useful for most server systems

OOM-killer acts if some process reclaims more and more
memory and the kernel randomly kills unimportant tasks
using hughe memory

in case of a running mysqld the classification "unimportant"
is nearly all time wrong and can cause hughe damage and work
in other words: you really never want killed a database server
randomly instead "dbmail-imapd" which can be restarted via
systemd without pain and may be the root-cause of OOM
_________________________________________

with one single command you can protect processes from get killed
i started to run this every 15 minutes to make sure it is also
active after restarts

i am considering include this in "mysqld.service" as
"ExecStartPost=-/usr/local/bin/mysql-no-oom.sh" in our
internal mysqld-packages and include also the script
_________________________________________

[root@mail:~]$ cat /etc/crontab | grep oom
0,15,30,45 * * * * root bash /usr/local/bin/mysql-no-oom.sh

[root@mail:~]$ cat /usr/local/bin/mysql-no-oom.sh
#!/bin/bash
pgrep -f "/usr/libexec/mysqld" | while read PID; do echo -1000 >
/proc/$PID/oom_score_adj; done


Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
FYI: how to prevent mysql from oom-killerReindl Harald13 Apr
  • Re: FYI: how to prevent mysql from oom-killerMihamina Rakotomandimby13 Apr
    • Re: FYI: how to prevent mysql from oom-killerReindl Harald13 Apr
  • Re: FYI: how to prevent mysql from oom-killerJohnny Withers13 Apr
    • Re: FYI: how to prevent mysql from oom-killerReindl Harald13 Apr