MongoDB NUMA series problem three: Overcommit_memory and Zone_reclaim_mode

Source: Internet
Author: User

Kernel parameter overcommit_memory:

It is a memory allocation policy

Optional values: 0, 1, 2.
0: Indicates that the kernel will check if there is enough available memory to use the process, and if there is enough memory available, the memory request is allowed; otherwise, the memory request fails and the error is returned to the application process.
1: Indicates that the kernel allows all physical memory to be allocated regardless of the current state of memory.
2: Indicates that the kernel allows allocating more memory than the sum of all physical memory and swap space

Kernel parameter zone_reclaim_mode:

Selectable values 0, 1
A, when a node is low on available memory:
1, if 0, then the system will be inclined to allocate memory from other nodes
2, if 1, then the system will be inclined to reclaim the cache memory from the local node most of the time
B, cache is very important for performance, so 0 is a better choice.

Overcommit and Oom:

Linux responds "Yes" to most requests for memory so that it can run more and bigger programs. Memory is not used immediately after memory is applied. This technique is called overcommit. OOM Killer (oom=out-of-memory) occurs when Linux discovers that there is not enough memory. It chooses to kill some processes (the user-state process, not the kernel thread) in order to free up memory.

When oom-killer occurs, which processes does Linux choose to kill? The function that selects a process is the oom_badness function (in MM/OOM_KILL.C), which calculates the number of points (0~1000) per process. The higher the number of points, the more likely the process is to be killed. The number of points per process is related to Oom_score_adj, and Oom_score_adj can be set (-1000 min, 1000 max).

Workaround:

Very simply, follow the prompts (set Vm.overcommit_memory to 1) to:

There are three ways to modify kernel parameters, but to have root privileges:

(1) Edit/etc/sysctl.conf, change Vm.overcommit_memory=1, and sysctl-p make the configuration file effective

(2) Sysctl Vm.overcommit_memory=1

(3) echo 1 >/proc/sys/vm/overcommit_memory

MongoDB NUMA series problem three: Overcommit_memory and Zone_reclaim_mode

Related Article

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.