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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Linux how to use commands to release memory", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux how to use commands to release memory" bar!
The WEB server built in VPS runs for a long time, and the use of memory becomes higher and higher. For VPS with small memory, SWAP partition may be used directly, thus affecting the performance of system applications. Here is a very simple script to clean up linux memory. As long as you put it into the crontab scheduled task and execute it regularly, you can clean up your Linux server memory on a regular basis.
The code is as follows
#! / bin/bash
# Data is written to the disk cache
Sync
# Clean Page Cache
Echo 1 "/ proc/sys/vm/drop_caches
Sync
# Clean All Cache
Echo 3 "/ proc/sys/vm/drop_caches
There are 4 values in / proc/sys/vm/drop_caches, which are 0-3:
0-No release
1-release the page cache
2-release dentries and inodes
3-release all caches
Write a script and give the script executable permission to be executed on a regular basis in crontab:
Add: manual memory release method
The code is as follows
Sudo sh-c "echo 1" / proc/sys/vm/drop_caches "
Sudo sh-c "echo 2" / proc/sys/vm/drop_caches "
Sudo sh-c "echo 3" / proc/sys/vm/drop_caches "
Thank you for reading, the above is the content of "Linux how to use commands to release memory". After the study of this article, I believe you have a deeper understanding of how Linux uses commands to release memory, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.