Live Help

Email

Skype Chat
Yahoo Chat

Client portal

VPS Service

preventing OOM-killer being invoked

September 25, 2015     1 comment

The Linux kernel likes to always allocate memory if applications asking for it. Per default it doesn’t really check if there is enough memory available. Given that behavior applications can allocate more memory as really is available. At some point it can definitely cause an out of memory situation. As result the OOM killer will be invoked and will kill that process:

Jun 11 11:35:21 vsrv03 kernel: [378878.356858] php-cgi invoked oom-killer: gfp_mask=0x1280d2, order=0, oomkilladj=0
Jun 11 11:36:11 vsrv03 kernel: [378878.356880] Pid: 8490, comm: php-cgi Not tainted 2.6.26-2-xen-amd64 #1

The downside of this action is that all other running processes are also affected. As result the complete VM didn’t work and needed a restart.

To fix this problem the behavior of the kernel has to be changed, so it will no longer overcommit the memory for application requests. Finally I have included those mentioned values into the/etc/sysctl.conf file, so they get automatically applied on start-up:

vm.overcommit_memory = 2
vm.overcommit_ratio = 100


some articles may advise to set the overcommit_ratio to 100, which you may put and monitor the results as well.


to have immediate effect, type like below:

# echo 100 > /proc/sys/vm/overcommit_ratio

# echo 2 > /proc/sys/vm/overcommit_memory


How helpful was this article to you?

1 Comments

icon
Benny Kusman
June 11, 2014

Default value for /proc/sys/vm/overcommit_ratio is 50, and /proc/sys/vm/overcommit_memory is 0

cPanel Partner NOC