Raid 5 performance

John Macdonald john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Wed Sep 22 01:04:32 UTC 2004


On Tue, Sep 21, 2004 at 05:42:16PM -0400, Ralph Doncaster wrote:
> On Tue, 21 Sep 2004, Lennart Sorensen wrote:
> 
> > On Tue, Sep 21, 2004 at 04:40:50PM -0400, Ralph Doncaster wrote:
> > > Make sure you use 3 or 5 disks, not 4.
> > > Use hdparm to tune the transfer rates of each disk.
> >
> > Why not 4?  How would that cause any impact on a raid5 setup?
> 
> To avoid having to read from the odd data disk in order to calculate the
> checksum when doing a write.

With 3 disks (2 data + 1 parity) there is a speedup, but for
more than 2 data disks there is no difference in the cost of
a write.

with 2+1 disks (called d1, d2, and dp, to write a sector on d1,
you just compute the parity from scratch:

    read matching sector from d2
    xor d2 data with d1 data
    write d1 data to d1
    write xor data to dp

with n+1 disks (called d1, d2, ... dn, and dp), to write a
sector on d1, you compute the change to apply to the old parity
(since the old parity is correct for all of the sectors except
the one that is being changed):

    read old sector from d1
    read matching sector from dp
    xor dp data with old d1 data
    xor dp(xor)old d1 data with new d1 data
    write final xor result to dp
    write new d1 data to d1

However, this parity computation can be optimized if the data is
striped across all of the disks, and a long enough write occurs.
Then, simply compute the new parity sector from scratch whenever
a complete set of d1..dn is being written and then write all
n+1 sectors at once with no reads required.  This means that
the parity is being computed and written only once for every
n data records that are written, and no old data needs to be
read in to accomplish it.

In fact, whenever half or more of the data sectors are being
overwritten, it is cheaper to read the other sectors and compute
the parity than to read the old data of the overwritten sectors
to compute the delta.  The 2+1 case above is actually just
one case of this.  However, if the old data happens to be
lying around in cache already then going back to the delta
computation is cheaper.  The answers is always "it depends".

-- 
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list