Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Increasing/delaying disk write cache - how?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Malvineous
Apprentice
Apprentice


Joined: 20 Oct 2006
Posts: 281
Location: Brisbane, Australia

PostPosted: Wed Apr 30, 2008 9:58 pm    Post subject: Increasing/delaying disk write cache - how? Reply with quote

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
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Wed Apr 30, 2008 11:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Malvineous
Apprentice
Apprentice


Joined: 20 Oct 2006
Posts: 281
Location: Brisbane, Australia

PostPosted: Thu May 01, 2008 10:24 am    Post subject: Reply with quote

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
View user's profile Send private message
HolgerH
n00b
n00b


Joined: 02 Mar 2008
Posts: 16

PostPosted: Thu May 01, 2008 4:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum