In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to change the linux operating system file cache refresh strategy", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to change the linux operating system file cache refresh policy.
Environment description
The following tests are valid on centos/RHEL 6 and centos/RHEL 7 for linux operating systems.
Related parameters
The following two parameters are mainly related to the file system write caching strategy. Other relevant references can be made by Google:
/ proc/sys/vm/dirty_ratio
The size of the file system write buffer, in percentage, indicates the percentage of system memory, indicating that when the write buffer uses up to the system memory, it begins to write data to disk. As a result, more system memory is used for disk write buffering, which can also greatly improve the write performance of the system. However, when continuous, constant writes are required, the value should be reduced.
/ proc/sys/vm/dirty_background_ratio
Controls when the pdflush process flushes the disk. The unit is a percentage, which represents the percentage of system memory, which means that when the write buffer uses up to how much system memory is used, pdflush begins to write data to disk. As a result, more system memory is used for disk write buffering, which can also greatly improve the write performance of the system. However, when continuous and constant writing is required, the value should be reduced.
Comparison and explanation
Vm.dirty_background_ratio: this parameter specifies that when the number of dirty pages cached by the file system reaches how many percent of the system memory (e.g. 5%), background write-back processes such as pdflush/flush/kdmflush will be triggered to run, and certain cached dirty pages will be brushed into external memory asynchronously.
Vm.dirty_ratio: this parameter specifies that when the number of dirty pages cached by the file system reaches 10% of the system memory (for example, 10%), the system has to start processing dirty pages (because there are already a large number of dirty pages, and some dirty pages need to be brushed into out-of-memory to avoid data loss). In this process, many application processes may be blocked because the system turns to processing file IO.
Normally, the condition of vm.dirty_background_ratio is reached first, and then the flush process is triggered to write back asynchronously, but during this process, the application process can still write. If the amount written by multiple application processes is greater than the amount brushed out by the flush process, it will naturally reach the threshold set by the parameter vm.dirty_ratio. At this time, the operating system will switch to the process of dealing with dirty pages synchronously, blocking the application process.
That is to say, normal vm.dirty_background_ratio
< vm.dirty_ratio才有意义。 在经常有大量写入操作的系统中,应该分别调低这两个参数的值,加快数据刷盘的频率,从而避免因系统同步处理文件IO而导致相关进程处于D状态。 参数修改方法 临时生效方法(重启后失效): echo 5 >/ proc/sys/vm/dirty_background_ratioecho 10 > / proc/sys/vm/dirty_ratio
Or
Sysctl-w vm.dirty_background_ratio=5sysctl-w vm.dirty_ratio=10
Permanent effective method:
Echo "vm.dirty_background_ratio = 5" > > / etc/sysctl.confecho "vm.dirty_ratio = 10" > > / etc/sysctl.confsysctl-p / etc/sysctl.conf so far, I believe you have a deeper understanding of "how to change the linux operating system file cache refresh policy". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.