Out of memory with lots of swap space?

by abatie   Last Updated September 11, 2019 19:00 PM

I have a small rackspace vm (512M) running centos 6.9. It's running a secondary nameserver and a tiny wordpress instance for showing status. I don't want to pay 3x the price for a little more memory and a bunch of disk space I don't need.

The problem is that mysqld and/or named frequently get killed with out of memory errors. I added 1G of swap space when the problem first started happening and it doesn't seem to be helping and in fact, in the log messages that get dumped when this happens, it even says there's little swap being used:

Sep 10 20:51:12 rackit2 kernel: 2978 total pagecache pages Sep 10 20:51:12 rackit2 kernel: 2361 pages in swap cache Sep 10 20:51:12 rackit2 kernel: Swap cache stats: add 148505795, delete 148503434, find 96388662/110607450 Sep 10 20:51:12 rackit2 kernel: Free swap = 953396kB Sep 10 20:51:12 rackit2 kernel: Total swap = 1035256kB Sep 10 20:51:12 rackit2 kernel: 131071 pages RAM Sep 10 20:51:12 rackit2 kernel: 5834 pages reserved Sep 10 20:51:12 rackit2 kernel: 1767 pages shared Sep 10 20:51:12 rackit2 kernel: 119683 pages non-shared

The other odd thing is that it says it's killing httpd, when in fact, it killed mysqld:

Sep 10 20:51:12 rackit2 kernel: Out of memory: Kill process 16299 (httpd) score 15 or sacrifice child Sep 10 20:51:12 rackit2 kernel: Killed process 16299, UID 48, (httpd) total-vm:382360kB, anon-rss:15648kB, file-rss:12kB

# ps ax | grep httpd 3904 pts/0 D+ 0:00 grep httpd 13721 ? S 0:09 /usr/sbin/httpd 26698 ? S 0:20 /usr/sbin/httpd 30254 ? Ss 14:41 /usr/sbin/httpd # ps ax | grep mysqld 3906 pts/0 S+ 0:00 grep mysqld #

I see a discussion about commit limits in Linux oom appears to have inappropriately killed a process - what might I be missing? but that seems to be plenty high also:

CommitLimit: 1285728 kB Committed_AS: 276332 kB

(and after restarting mysqld:)

CommitLimit: 1285728 kB Committed_AS: 602712 kB



Related Questions


Updated February 24, 2016 01:00 AM

Updated October 30, 2018 08:00 AM

Updated May 11, 2019 14:00 PM

Updated July 25, 2017 08:00 AM

Updated July 23, 2017 01:00 AM