228Appendix A: Optimizing RAID 5 Write Performancewww.gateway.comIntroductionWith a typical RAID 5 implementation, there are a number of steps necessaryto write the data to the media. Every write from the host system will typicallygenerate two XOR operations and their associated data transfers to two drives.If the accesses are sequential, the parity information will be updated a numberof times in succession. However, if the host writes sufficient data to cover acomplete stripe, the parity data does not need to be updated for each write. Itcan be recalculated instead. This operation takes only one XOR operation perhost write, compared to two for a standard RAID 5 write. The number of datatransfers necessary are also reduced, increasing the available bandwidth. Thistype of write access is termed a Full Stripe Write.The table shows the distribution of data chunks (denoted by Cx) and theirassociated parity (denoted by P(y-z)) in a RAID 5 array of five drives. An arrayis defined as a set of drives, on which data is distributed. An array will haveone RAID level. A chunk is the amount of contiguous data stored on one drivebefore the controller switches over to the next drive. This parameter isadjustable from 64 K to 256 K, and should be carefully chosen to match theaccess sizes of the operating system. A stripe is a set of disk chunks in an arraywith the same address. In the above example, Stripe 0 consists of C0, C1, C2,and C3 and their associated parity.Maximum performance will be achieved when all drives are performingmultiple commands in parallel. To take advantage of a Full Stripe Write, thehost has to send enough data to the controller. This can be accomplished intwo ways. If the host sends one command with sufficient data to fill a stripe,then the controller can perform a Full Stripe Write. Alternatively, if the hostsends multiple sequential commands, smaller than a stripe size (typicallymatching the chunk size), the controller can internally combine thesecommands to get the same effect. In the above example, if a 256 K chunk sizeP (20-23) C20 C21 C22 C23 Stripe 5P (16-19)C17 C18 C19 Stripe 4P (12-15)C13 C14 C15 Stripe 3P (8-11)C9 C10 C11 Stripe 2P (4-7)C16C12C8C4 C5 C6 C7 Stripe 1P (0-3) C0 C1 C2 C3 Stripe 0