From: Reindl Harald Date: April 13 2012 12:17pm Subject: FYI: how to prevent mysql from oom-killer List-Archive: http://lists.mysql.com/mysql/227187 Message-Id: <4F881946.5020601@thelounge.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1D64CACA3C9AA8FB2D1B5289" --------------enig1D64CACA3C9AA8FB2D1B5289 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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=3D-/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/$P= ID/oom_score_adj; done --------------enig1D64CACA3C9AA8FB2D1B5289 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+IGUYACgkQhmBjz394Anm26gCffKrPbYO3+TMEii+H/amIsOVA vJMAn3vnmChv2n4wQ71jtGNj4tplhnI7 =yHhr -----END PGP SIGNATURE----- --------------enig1D64CACA3C9AA8FB2D1B5289--