Linux – Write cache settings not working

cachelinuxlinux-kernelmdadmraid

I am using Debian 8.0 x64 with 72 GB of RAM with 4 drives configured as software RAID 0.

Linux s1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux

I tried setting dirty pages to 2GB cache before actual writing. I also tried setting the "dirty_ratio" and "dirty_background_ratio" settings to use 50% of RAM but that didn't work either. The pdflush daemon should start every minute and expire time for dirty pages was set to 10 minutes.

I checked the disk I/O using "iotop" and it showed disk a high writing activity. Also "cat /proc/meminfo" showed that the "Dirty" value is getting smaller (probably due to writing). Before checking I ran "sync" and "drop_caches". I tested using the "dd" command writing a 1GB file of zeroes.

  • Here are the settings:

echo 0 > /proc/sys/vm/dirty_background_ratio

echo 2147483648 > /proc/sys/vm/dirty_background_bytes

echo 0 > /proc/sys/vm/dirty_ratio

echo 2147483648 > /proc/sys/vm/dirty_bytes

echo 6000 > /proc/sys/vm/dirty_writeback_centisecs

echo 30000 > /proc/sys/vm/dirty_expire_centisecs

  • Mount options:

/dev/md0 on /test type ext4 (rw,noatime,nodiratime,nobarrier,stripe=512)

Suggestions?

Best Answer

Try to increase md/stripe_cache_size here file which you have to create

#/etc/udev/rules.d/83-md-stripe-cache.rules
KERNEL=="md*", ACTION=="add", TEST=="md/stripe_cache_size", ATTR{md/stripe_cache_size}="8192"

It worked for me on Raid-6

And I suggest you to reduce dirty ratio because it caused me problems on x64 system I use this settings

add to /etc/sysctl.conf

vm.dirty_bytes = 16777216 #16Mb
vm.dirty_background_bytes = 835584 #mb