High Linux memory usage, triggering system downtime

Source: Internet
Author: User
Tags system log

Excerpt from: http://www.cnblogs.com/itfriend/archive/2011/12/14/2287160.html

On-line solution: Use PS to view the memory of each process, about 4G, most of the memory is occupied by page cache. The strategy of the Linux kernel is to maximize the use of memory Cache file system data, improve the IO speed, although the mechanism is that the process requires more memory, the page Cache will be automatically freed, but does not rule out the release of memory due to fragmentation does not meet the memory requirements of the process.

So we need a way to limit the pagecache limit.

Linux provides such a parameter, min_free_kbytes, to determine the threshold at which the system starts to reclaim memory and to control the system's free memory. The higher the value, the sooner the kernel starts to reclaim memory, and the higher the free memory.

[[email protected] root]# cat /proc/sys/vm/min_free_kbytes163840echo 963840 > /proc/sys/vm/min_free_kbytes

Other optional temporary workarounds:

Close Oom-killer

Cat/proc/sys/vm/oom-kill
echo "0" >/proc/sys/vm/oom-kill
Vi/etc/sysctl.conf
Vm.oom-kill = 0

2. Empty the cache (optional)
Echo 1 >/proc/sys/vm/drop_caches


Actual analysis: Memory only left 50MB,4GB memory is mostly occupied by the cache and buffer, resulting in system downtime, the current

Set the threshold value of the Min_free_kbytes

#echo 400000 >/proc/sys/vm/min_free_kbytes

But in fact, it doesn't solve the problem fundamentally.

The situation is as follows:

1) The memory gradually reduced to 50MB time, began to release, then reached 400MB, gradually use, finally back to 50MB, in turn, loop, in fact, is very dangerous, resulting in downtime, this setting is not real-time, but a threshold detection.

2) There is a print of out of memory and there is a problem with the system log.

Conclusion: The set threshold is not effective in real time, but a dynamic change process.


High Linux memory usage, triggering system downtime

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.