I need to protect mysql process so that it won't be killed when system runs out of memory, we have a bunch of adhoc job run on the server from time to time, so I would prefer the adhoc jobs being killed rather than mysql.
I know I can adjust the oom_score_adj, by setting it to -1000, I can exclude it from OOM killer's consideration. But I am not sure if I need to restart the mysql process for new oom_score_adj to take effect? Does adjust the oom_score_adj for a running process still takes effect?
I was following this post and nobody else mentioned about restarting the server for new oom_score_adj to take effect: https://blog.rimuhosting.com/2015/12/11/dont-let-the-oom-killer-stop-mysql/
Another dumb question is that I can't seem to write to the oom_score_adj file, always getting the permission denied. The oom_score_adj is not owned by root, I have tried a couple of options but keep getting the permission issue:
echo "echo '-100' > /proc/5653/oom_score_adj" | sudo -u {file_owner} sh
Appreciated for any help!
Linux version 4.9.184-0.1.ac.235.83.329.metal1.x86_64 (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC) )
. I have read about Ubuntu having the mechanism to specify OOM score in the init script, it does not look like REHL has the same thing?