View previous topic :: View next topic |
Author |
Message |
Malvineous Apprentice
Joined: 20 Oct 2006 Posts: 281 Location: Brisbane, Australia
|
Posted: Wed Apr 30, 2008 9:58 pm Post subject: Increasing/delaying disk write cache - how? |
|
|
Hi all,
I seem to be working with larger and larger files these days, and because I'm running a RAID array my disks appear as a single drive (/dev/md0). This means that when I want to process a large file, the system needs to read *and* write to the same disk, at the same time. This really kills the performance, slowing down both reads and writes to ~50MB/sec.
What I would really like to do is to tell the kernel not to bother flushing the write cache for at least 15-20 seconds, which would permit the array to *only* read at ~180MB/sec for a few seconds, then *only* write at ~180MB/sec for a few seconds, massively reducing the total time required to perform the overall operation.
The system is 64-bit with 4GB RAM, so there shouldn't be any issue with running out of memory for the cache. I've tweaked /proc/sys/vm/dirty_* but all I can manage is full read speeds for 4-5 seconds before the kernel starts writing stuff out to disk, even though dirty_writeback_centisecs is set to 1998 (which is supposed to be 20 seconds.)
Any ideas where I can control these parameters? Thanks! |
|
Back to top |
|
|
Akkara Bodhisattva
Joined: 28 Mar 2006 Posts: 6702 Location: &akkara
|
Posted: Wed Apr 30, 2008 11:25 pm Post subject: |
|
|
Have you set /proc/sys/vm/dirty_ratio too? I think that one is the maximum percent of ram that can be used for unwritten buffers before it starts flushing. |
|
Back to top |
|
|
Malvineous Apprentice
Joined: 20 Oct 2006 Posts: 281 Location: Brisbane, Australia
|
Posted: Thu May 01, 2008 10:24 am Post subject: |
|
|
Thanks for your reply. Yes, I've set dirty_ratio to 90 and dirty_background_ratio to 50, which should at least permit 2GB to build up before writing starts, but I only get about 400MB written before it starts writing and everything slows down. |
|
Back to top |
|
|
HolgerH n00b
Joined: 02 Mar 2008 Posts: 16
|
Posted: Thu May 01, 2008 4:59 pm Post subject: |
|
|
You can also try to increase vm.dirty_writeback_centisecs - I believe the default is 500, which causes the flush daemon to wake up every 5 seconds. The overall time that dirty pages can hang around in memory is governed by vm.dirty_expire_centisecs.
You may also want to try another disk scheduler like deadline. You can see which one is active on your system, likely cfq, like this:
$cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]
Replace sda with your main block device and echo the new value (deadline) into the scheduler variable. This is safe to do at runtime. |
|
Back to top |
|
|
|