[clue-tech] Software RAID

marcus hall marcus at tuells.org
Mon Jun 6 21:35:39 MDT 2005


Russ asked:
> At any rate, what difference does
> it make to read a swap from a physical device, rather than two
> physical devices? ?Since this is a mirror, we're reading the same
> information from both drives at the exact same time. ?So there
> shouldn't be a significant time savings by having swap on a physical
> drive, compared to the RAID.

Jeff Schroeder answered:
> I'm not a RAID expert, but I don't think you want swap on RAID.  You're 
> right in that reading from the RAID won't make much difference, since 
> the data is the same on both physical devices.  However, when you're 
> writing to swap, the system has to write to both devices.  Thus your 
> swap writes take at least 2x longer.  Swap is slow enough as it is. ;)

RAID is generally *faster* than a single drive on read, and similar time
on write, at least for many common cases.

For a single process making sequential reads, the system can read ahead
and have data ready before the process needs it.  This is because it can
schedule the requested read on one drive and the read-ahead on the next.
If the seek and rotational delays are comparable on both drives (statistically
this should be pretty likely), then both reads will complete in the time
it would normally take a single read to complete, but the system will have
twice as much data ready.

For multiple processes making sequential or random reads, the reads can be
scheduled on alternating drives, so the system can service two requests in
the time it would normally take to service one request.

For a single process making random reads, read-ahead doesn't really help,
and the next read isn't scheduled until the current completes, so this case
goes at about the same speed as a non-RAID system.

For writes, if they are scheduled on both drives simultaneously, then they
will probably (again, if the seek and rotational latency is similar) take
about as long on each drive, so if the system is waiting until completion
of the writes, it should take marginally longer on RAID (we have to wait
for the *longest* latency, not the *average*, so it is a little slower).  If
the write is happening asynchronously, then we aren't waiting anyway, so
perhaps we're blocking some read parallelism, but it isn't much longer than
a non-RAID write.

*** Disclaimer ***

This should be taken with a grain of salt, since I have very minimal RAID
experience, but it *should* be possible to implement RAID like this
(there may be some limitations if the two RAID drives are on the same IDE
controller).  If it isn't, then I will be sorely disappointed!

> What you should probably do instead is specify *two* swap partitions in 
> your /etc/fstab file.  Just give the physical devices.  That'll not 
> only improve your swap performance, but will help you if a drive fails 
> because you won't need to switch things (I think).

But, if a drive fails, then you've lost the data that was on one of your
swap partitions!  This would make it a bit hard for the system to continue
on, wouldn't it?  Or do you accept a crash on disk failure, so long as
the system can be restored from the remaining drives...

Marcus Hall
marcus at tuells.org



More information about the clue-tech mailing list