FYI: how to prevent mysql from oom-killer

Bryn M. Reeves bmr at redhat.com
Fri Apr 13 13:54:39 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/13/2012 02:47 PM, Mihamina Rakotomandimby wrote:
> On 04/13/2012 03:17 PM, Reindl Harald wrote:
>> 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 understand your issue, but isn'there a configuration way to just
> limit the memory usage of MySQL?
> 

That won't affect the OOM killer's decision that mysqld is
"unimportant". Influencing that using the oom_score_adj tunable is
exactly the right way to do this as Harald said, from
filesystems/proc.txt:

"The value of /proc/<pid>/oom_score_adj is added to the badness score
before it is used to determine which task to kill. Acceptable values
range from -1000 (OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX).
This allows userspace to polarize the preference for oom killing
either by  always preferring a certain task or completely disabling
it. The lowest  possible value, -1000, is equivalent to disabling oom
killing entirely for that task since it will always report a badness
score of 0."

There are other tunables there (see proc.txt and the man page) but
this one gets the job done.

Regards,
Bryn.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+IMB8ACgkQ6YSQoMYUY94n4ACfe5hN6R5uKvZgpeDIDLk8arwj
p94AnjBEaSd4QdthfAlDMscSvoctl+/v
=8ocJ
-----END PGP SIGNATURE-----


More information about the users mailing list