In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to solve the overcommit_memory error report in redis database under linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how to solve the problem of overcommit_memory error reporting in redis database under linux.
Background
The company's redis is sometimes unsuccessful in background save db. The following alarm is found through log, which is likely to be caused by it:
[13223] 17 Mar 13:18:02.207 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory=1' to / etc/sysctl.conf and then reboot or run the command' sysctl vm.overcommit_memory=1' for this to take effect.
So through the search, some people have encountered the same problem as me, and it is almost certain that it is caused by it.
Kernel parameter overcommit_memory
It is a memory allocation strategy
Optional values: 0, 1, 2.
0, which means that the kernel will check whether there is enough memory available for the application process; 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, which means that the kernel allows all physical memory to be allocated, regardless of the current memory state.
2, indicating that the kernel allows more than the sum of all physical memory and swap space to be allocated
What are Overcommit and OOM?
Linux replies "yes" to most requests for memory so that it can run more and larger programs. Because memory will not be used immediately after applying for memory. This technique is called Overcommit. OOM killer (OOM=out-of-memory) occurs when linux finds that it is out of memory. It chooses to kill some processes (user-mode processes, not kernel threads) to free memory.
Which processes does linux choose to kill when oom-killer occurs? The function for selecting a process is the oom_badness function (in mm/oom_kill.c), which calculates the number of points for each process (0,1000). The higher the 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 lowest, 1000 highest).
Solution:
Simply follow the prompts (set vm.overcommit_memory to 1):
There are three ways to modify kernel parameters, but with root permission:
(1) Edit / etc/sysctl.conf, change vm.overcommit_memory=1, and then sysctl-p to make the configuration file effective
(2) sysctl vm.overcommit_memory=1
(3) echo 1 > / proc/sys/vm/overcommit_memory
At this point, I believe you have a deeper understanding of "how to solve the overcommit_memory error report of redis database under linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.