当前位置:网站首页>Redis fault handling "can't save in background: fork: cannot allocate memory“

Redis fault handling "can't save in background: fork: cannot allocate memory“

2022-07-07 08:48:00 IChen.

1. resolvent

(1) edit /etc/sysctl.conf add to

vm.overcommit_memory=1

(2) stay /etc Execute under directory sysctrl -p Make it effective

2.Linux Kernel parameters overcommit_memory

It is Memory allocation policy
Optional value :0、1、2.
0, Indicates that the kernel will check if there is enough memory available for the process to use ; If there is enough memory available , Memory request allows ; otherwise , Memory request failed , And return the error to the application process .
1, Indicates that the kernel is allowed to allocate all physical memory , Regardless of the current memory state .
2, Indicates that the kernel is allowed to allocate more memory than the sum of all physical memory and swap space

3. What is? Overcommit and OOM

Linux Most requests for memory are answered "yes", In order to run more and bigger programs . Because after applying for memory , Not immediately using memory . This technology is called Overcommit. When linux When there is not enough memory , It's going to happen OOM killer(OOM=out-of-memory). It will choose to kill some processes ( User state process , It's not a kernel thread ), To free up memory .
When oom-killer occurs ,linux Which processes will be killed ? The function for selecting a process is oom_badness function ( stay mm/oom_kill.c in ), The Function calculates the number of points per process (0~1000). The higher the number of points , The more likely this process is to be killed . The number of points per process followed by oom_score_adj of , and oom_score_adj Can be set (-1000 The minimum ,1000 The highest ).

原网站

版权声明
本文为[IChen.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070539451611.html