Linux out-of-memory (OOM) Killer

Source: Internet
Author: User
Tags metalink

On the Linux server encountered a small problem, go up and toss half a day. This is the first time that Linux has been aware of the features that have existed over the years: OOM Killer. To put it bluntly, the OOM Killer is a layer of protection that avoids the problem of not being too serious when Linux is in storage, killing the unimportant process and breaking the wrist.

To learn some old knowledge first, there is a limit to addressing in a 32-bit CPU architecture. The Linux kernel defines three zones:

# dma:0x00000000-  0x00999999 (0-16 <abbr title= "megabyte" >MB</abbr>) # lowmem:0x01000000-0x037999999 (16-896 <abbr title= "megabyte" >MB</abbr>)-size:880mb# highmem:0x038000000-&lt; hardware specific &gt;

The Lowmem area (also called NORMAL Zone) is 880 MB and cannot be changed (except with the Hugemem kernel). For high-load systems, it is possible to cause OOM Killer because of poor lowmem utilization. One possible reason is that lowfree is too few, another reason is that the lowmem is fragmented, the request is not contiguous memory area "according to a case I met, a conjecture is that some applications one-time request relatively large memory, exactly 880M, idle (lowfree) is not large enough, Will trigger the OOM Killer out to work. " Check the value of the current Lowfree:

# Cat/proc/meminfo |grep Lowfree

Check for Lowmem memory fragmentation:

# Cat/proc/buddyinfo

The above command is valid under the 2.6 Kernel environment. It is said that the way to use SYSRQ is better, but hang in time to use it. See Metalink note:228203.1.

According to some documentation, the OOM Killer behaves differently on 2.4 and 2.6. In version 2.4, the process of new incoming (new application memory) is killed. And 2.6 is killing the most memory-intensive process (which is very dangerous, it can easily lead to paralysis of the system application).

For RHEL 4, a new parameter has been added: Vm.lower_zone_protection. The default unit for this parameter is MB, Lowmem is 16MB when the default is 0. It is recommended to set vm.lower_zone_protection = 200 or greater to avoid fragmentation of the Lowmem area, which is an absolute solution to this problem.

For RHEL 3 (Kernel 2.4) There seems to be no good way, one is to use the Hugemem kernel (God knows will not introduce new problems), one is to upgrade to 2.4.21-47 and use the new core parameters Vm.vm-defragment control the number of fragments. And then use RHEL 4 (Kernel 2.6), which goes back. Plainly, if you encounter an OOM Killer, basically the lower version of Kernel is somewhat flawed in design.

Other, if go to query RedHat Bug Library, will find many Kernel version also has bug. Especially in scenarios where NFS is used.

Tip:oom Killer Shutdown and Activation mode:

# echo "0" >/proc/sys/vm/oom-kill# echo "1" >/proc/sys/vm/oom-kill

More reference information:

    • 1) OOM Killer "out of memory:killed process" solutions/summary "no bird for the case I met"
    • 2) Metalink Notes:linux Kernel lowmem pressure issues and Kernel structures
    • 3) Respite from the OOM killer

Linux out-of-memory (OOM) Killer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.