In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how Linux manually releases cache memory, Xiaobian thinks it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.
Operating System Oracle Linux 6.2 Oracle Database 11.2.0.3, System Memory 384 GB, 20 Core CPU
During today's business test, I found that the response time of DB node is much lower than Friday. The node memory is almost exhausted.
When we were conducting business tests, colleagues copied data on the node, copying 50G data to the node storage.
This is the business scenario at that time. When analyzing and locating, the memory was exhausted. When testing at ordinary times, the memory usage was about 200G.
So it's necessary to cache nodes manually.
On Linux, we generally don't need to free memory because the system already manages memory well. However, there are exceptions to everything. Sometimes memory will be occupied by cache, causing the system to use SWAP space to affect performance. At this time, it is necessary to perform the operation of releasing memory (cleaning cache).
Linux cache mechanism is quite advanced, he will be for dentry (for VFS, speed file path name to inode conversion), Buffer Cache (for disk block read and write) and Page Cache (for file inode read and write) cache operations But after a lot of file operations, the cache will run out of memory resources. But in fact, our file operation has been completed, and this part of the cache is no longer needed. At this point, can we just watch the cache take up memory space?
Therefore, we still need to manually release the memory operation under Linux, in fact, it is the operation of releasing the cache.
To do this, we first need to understand the key configuration file/proc/sys/vm/drop_caches. This file records the cache release parameters, the default value is 0, that is, do not release cache. Its value can be any number between 0 and 3, representing different meanings:
0 -Not released
1 -Free page cache
2 -Release entries and inodes
3 -Release all caches
Knowing the parameters, we can use the following commands to operate according to our needs.
First we need to write all unwritten system buffers to disk using the sync command, including modified i-nodes, delayed block I/O, and read-write mapping files. Otherwise, unsaved files may be lost during the cache release process.
#sync
Next, we need to write the required parameters into the/proc/sys/vm/drop_caches file. For example, if we need to release all caches, enter the following command:
#echo 3 > /proc/sys/vm/drop_caches
This command will take effect immediately after entering, you can query the available memory is now significantly more.
To query the parameters of the current cache release, enter the following command:
#cat /proc/sys/vm/drop_caches
About "Linux how to manually release cache memory" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
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.