I have a workload with extremely high write burst rates for short periods of times. The target disks are rather slow, but I have plenty of RAM and very tolerant to instantaneous data loss.

I've tried tuning vm.dirty_ratio to maximize the use of free RAM space to be used for dirty pages.

# free -g
              total        used        free      shared  buff/cache   available
Mem:            251           7         213           3          30         239
Swap:             0           0           0

# sysctl -a | grep -i dirty
vm.dirty_background_bytes = 0
vm.dirty_background_ratio = 5
vm.dirty_bytes = 0
vm.dirty_expire_centisecs = 90000
vm.dirty_ratio = 90

However, it seems I'm still encountering some writeback throttling based on the underlying disk speed. How can I disable this?

# dd if=/dev/zero of=/home/me/foo.txt bs=4K count=100000 oflag=nonblock
100000+0 records in
100000+0 records out
409600000 bytes (410 MB) copied, 10.2175 s, 40.1 MB/s

As long as there is free memory and the dirty ratio has not yet been exceeded - I'd like to write at full speed to the page cache.


1 Answer 1


The problem is not the dirty-throttling, but the immediate syncing. You can check it with the bo column in vmstat 1 - I get:

   bi    bo
    0     0
    0     0
    0  4000
    0     0

after dd if=/dev/zero of=16/test bs=4k count=1000. (The vmstat output is just 1K-"units" - /proc/diskstats has 512B-units)

Adding conv=notrunc avoids that, as does a rm before. See sourcejedi's comment.

The ext4 mount option noauto_da_alloc exactly is meant for that: no extra sync for these "write-file-anew" operations. man ext4 has some good examples. The question goes back to what should "write" or "save" file mean in an editor, and how to make that (power-) fail-safe.

You can also check the other side: the dirty pages growing:

]# grep nr_dirty /proc/vmstat      
nr_dirty 7886
nr_dirty_threshold 427666
nr_dirty_background_threshold 170815

The thresholds are the ratios applied to the current available memory. Only since I quite disabled the periodic writebacks I see more than a dozen dirty pages.


It is really a complex situation; vim has at least two crucial options: fs and wb: filesync after write and overwrite via backup.

On ext2 it is enough to set nofs in vim. On ext4 (with default delayed allocation) the noauto_da_alloc mount option is also needed to prevent an immediate syncing, this time by the filesystem.

(with dd you have the option to (over)write only a part of a file, unlike cp or vim)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .