Score:0

Write cache / delay as long as possible

us flag

I am trying to setup Linux to delay the writes as much as possible (minutes). To those wondering why: this is Chia plotting. It is very write intensive done in SSD/NVMe, if the system crashes you have to restart from scratch anyways.

Minimizing the writes to disk actually increase the life expectancy for the disks.

That said I setup a testing system (20.04.1-Ubuntu LTS in a VM Hyper V - Windows 10).

I setup my "dirty" flags as:

sudo  sysctl -a | grep dirty
vm.dirty_background_bytes = 0
vm.dirty_background_ratio = 75
vm.dirty_bytes = 0
vm.dirty_expire_centisecs = 120000
vm.dirty_ratio = 80
vm.dirty_writeback_centisecs = 180000
vm.dirtytime_expire_seconds = 43200

That gives me about 3GB of cache (I am using 4GB ram for this VM).

I am following these instructions to test, changed to this (so it is random and 1GB)

 dd if=/dev/random of=testfile.txt bs=1M count=1000

And using

cat /proc/meminfo | grep Dirty
cat /proc/vmstat | egrep "dirty|writeback"

To see whether the number of dirty pages are increasing as it makes progress.

The number of dirty pages increases as expected until dd finishes. When it finishes the number of dirty pages goes almost instantaneously to 0 and Windows starts writing the data (I am monitoring the Windows side using the Resource Monitor to see when the writes actually hit the disk).

So... is it because Linux flush the file as soon as it is closed by dd? maybe it is dd doing the flushing? I was expecting the file to remain in the dirty pages as it is smaller than the available space for that (this testing system is not doing anything else).

Any ideas? Thanks.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.