×
Blog Technologies Web Hosting Support

Steps To Overcome Out Of Memory Killer

In this blog, we will show you the basic Steps to Overcome Out of Memory Killer.

 

OVERVIEW

The Linux kernel will execute the command to kill the out of memory. When your server runs out of memory. While executing the command, the memory will be free on the system by killing the memory intensive process (this could be the most important process like Apache, MySQL or anything).

One fine day on the client business hour, everything seems to be better. But suddenly you started to get emails and calls from your clients and reporting about the server crash.

You rushed into the server and checking the APACHE, which was inactive now, Finally, you started the service. Is that an end? No, you must check why the process got stopped on its own.
You started to investigate the issue by checking.

/var/log/messages

 

Steps To Overcome Out Of Memory Killer

And found the log as

Host kernel: Out of Memory: Killed process 2500 (Apache)

This is what OOM KILLER is …

WAY TO OVERCOME!k

There are 2 ways to Escape from the killer.

  • Need to upgrade the Hardware.
  • Need to tweak server.

CALCULATION METHOD

The process often get kill based on the oom_score. The oom_score is “10 x total memory consumption”. Which means the amount of memory can be used is 100%, so 10 × 100 is = 1000. The maximum score will be 1000.

You can find by using.

Cat /proc/2500/oom_score:
Note: 2500(Apache) is process id.

So now we know how it gets killed, so how do we just save it? There is another file called oom_score_adj

The final adjusted calculated score will be present here.

So adjusting the score here will be reflected on the process, if we enter the largest negative number which is -1000 then chances of the process getting killed are LOW, meanwhile, if we enter the largest number 1000 then the possibilities of getting killed is SUPER HIGH.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.