Use scripts to release CentOS system memory

Source: Internet
Author: User
In the past few days, the CentOS system memory has been rising. even if apache and mysql are disabled, the memory will not be released. you can use the following script to release the memory :#! /Bin/bash # release cache:

In the past few days, the CentOS system memory has been increasing. even if apache and mysql are disabled, the memory will not be released. you can use the following script to release the memory:

Script content :#! /Bin/bash # cache release: # To free pagecache: sync # echo 1>/proc/sys/vm/drop_caches # To free dentries and inodes: # echo 2>/proc/sys/vm/drop_caches # To free pagecache, dentries and inodes: echo 3>/proc/sys/vm/drop_caches use the crontab system To run automatically every day: crontab-e: 00 00 ***/root/Cached. sh releases the memory at every day. you can modify the settings as needed during this time. /Cached. if an error occurs during sh: Permission denied Permission, run: chmod + x. cached. sh also You can modify/etc/sysctl. conf to automatically release the cache. However, if the memory is not enough, it is best to look for other reasons, such as whether the program is set properly, whether the traffic volume is too large, or whether the program design is unreasonable, leading to memory overflow, after all, the design of the operating system will consider all aspects of the problem, and force the size of the cache to free up, it may only temporarily block the problem, is not conducive to judging the problem.
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.