我目前正在尝试使用/proc/sys/vm中的内核参数,尤其是dirty_ratio和dirty_background_ratio.
I'm currently experimenting with the kernel parameters found in /proc/sys/vm, especially dirty_ratio and dirty_background_ratio.
内核文档对这两者都有以下说明:
The kernel doc has the following explanations for both:
dirty_background_ratio
dirty_background_ratio
包含包含可用页面的总可用内存的百分比 和可回收页面,即后台内核所在的页面数 刷新器线程将开始写出脏数据.
Contains, as a percentage of total available memory that contains free pages and reclaimable pages, the number of pages at which the background kernel flusher threads will start writing out dirty data.
和
dirty_ratio
dirty_ratio
包含包含可用页面的总可用内存的百分比 和可回收页面,指的是要处理的页面数 生成磁盘写操作本身将开始写脏数据.
Contains, as a percentage of total available memory that contains free pages and reclaimable pages, the number of pages at which a process which is generating disk writes will itself start writing out dirty data.
在我的Linux系统上,dirty_background_ratio是10,而dirty_ratio是20.因此,如果我的已用内存达到10%,内核将开始回写,并且永远不会达到20%.
On my linux system dirty_background_ratio is 10 and dirty_ratio is 20. I understand that the difference is, who the dirty data writes. So if my used memory reaches 10% the kernel starts writing back and 20% should never be reached.
我现在的问题是:dirty_background_ratio和dirty_ratio的较高值有什么含义吗?还是仅是较低的值是谁?"的问题?
My question now is: Has the higher value of dirty_background_ratio and dirty_ratio any meaning or is it just a matter of "what is the lower value and who has it"?
推荐答案
dirty_background_ratio和dirty_ratio的较高值是否有意义?或者仅仅是较低的值是谁,谁拥有它"的问题?
Has the higher value of dirty_background_ratio and dirty_ratio any meaning or is it just a matter of "what is the lower value and who has it"?
更简单的话:
vm.dirty_background_ratio 是系统内存的百分比,当该内存变脏时,系统可以开始将数据写入磁盘.
vm.dirty_background_ratio is the percentage of system memory which when dirty then system can start writing data to the disks.
vm.dirty_ratio 是系统内存的百分比,当该内存脏时,执行写操作的进程将阻止并将脏页写出到磁盘.
vm.dirty_ratio is percentage of system memory which when dirty, the process doing writes would block and write out dirty pages to the disks.
此可调参数取决于系统的运行状况,如果运行大型数据库,则建议将这些值保持较低,以避免I/O瓶颈和系统负载增加时.
This tunable depends on what your system running, if you run large database its recommend to keep these values low to avoid I/O bottle-necks and when the system load increases.
例如:
vm.dirty_background_ratio=10 vm.dirty_ratio=15在此示例中,当脏页超过vm.dirty_background_ratio=10时,将启动I/O,即开始刷新/写入磁盘.当脏页总数超过vm.dirty_ratio=15时,所有写入将被阻止,直到某些脏页被写入磁盘为止.您可以将vm.dirty_ratio=15视为上限.
In this example when the dirty pages exceed vm.dirty_background_ratio=10 I/O starts, i.e they start getting flushed / written to the disk. When total number of dirty pages exceed vm.dirty_ratio=15 all writes get blocked until some of the dirty pages get written to disk. You can think of the vm.dirty_ratio=15 as the upper limit.
更多推荐
vm.dirty
发布评论