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

  • It would seem like you need to tune apache and/or mysqld to use less. memory. I have a smallish VM server, and have finetuned mysql with key_buffer_size = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 – davidgo Sep 11 '19 at 20:15
  • query_cache_limit = 1M query_cache_size = 16M – davidgo Sep 11 '19 at 20:16
  • That doesn't seem to have made much difference in the memory usage, but I'll let it run a while and see if it stabilizes...though it still doesn't explain why it's getting out of memory errors while there's still lots of swap space... – abatie Sep 12 '19 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.