Can ' t rewrite append only file in Background:fork:Cannot allocate memory

Source: Internet
Author: User

Today, the Redis service log reported the following error:

Can ' t rewrite append only file in Background:fork:Cannot allocate memory

Starting automatic rewriting of AOF on 138% growth


From the log to see is aof persistence when the memory is not enough to cause. Look again. The value of MaxMemory is just half of the physical memory. It should be the service Redis persistence memory allocation principle, to give the fork out of the backup process half the memory of the rich. There is a lot more to do with the free command to see unused memory. That's strange. What's the situation?

Is there a problem with memory allocation settings that are not system-aware? Just view/proc/sys/vm/overcommit_memory currently set to 0 (this is the memory setting that Redis optimization often involves)

Overcommit_memory parameter Description:

Set the memory allocation policy (optional, set according to the actual situation of the server)

/proc/sys/vm/overcommit_memory

Optional values: 0, 1, 2.

0, indicates that the kernel will check for sufficient available memory to be used by the process, and if sufficient memory is 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, which indicates that the kernel allows allocating more memory than the sum of all physical memory and swap space


In that case, set it to "1". Sure enough, in the DB directory, the temp file is generated and the file is rewritten to start.

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8F/C4/wKioL1jsgweAIKbGAAF9_D2eiJ0627.png-wh_500x0-wm_ 3-wmp_4-s_3299911872.png "title=" 1.png "alt=" Wkiol1jsgweaikbgaaf9_d2eij0627.png-wh_50 "/>

Memory is almost fully allocated during the rewrite process;

After rewriting the file has become the actual size of the data (see AOF persistent Official document); log display is normal;

Then free to view the memory situation, Redis has freed the memory just used;


This article from "Good Life, happy work!" "Blog, be sure to keep this provenance http://yjw1983.blog.51cto.com/265702/1914916

Can ' t rewrite append only file in Background:fork:Cannot allocate memory

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.