Tuesday, April 19, 2016

Protecting your data | RAID levels and their write penalties

Protecting your data | RAID levels and their write penalties

RAID Levels


Redundant array of independent disks or RAID is commonly used in servers, enterprise storage appliances and even your home NAS (I hope) to protect the data against disk failure.

Usually a RAID array is created using a RAID controller but software RAID is possible too. Common is that in an enterprise environment hardware RAID controllers are used since they offer some benefits over a software RAID implementation. In either case, if a disk fails, the data would not be lost. In fact, your storage will stay online as long as you did not create a RAID 0 volume or a so called striped volume.

Three types of RAID or RAID levels are very common. But each have their own characteristics.

  • RAID 1
  • RAID 5
  • RAID 1+0

RAID 0 is not on the list, simply because if its intolerance for disk failure. In other words, if just one disk fails you loose all data on the whole volume. RAID 6 has a high write penalty and therefor I will only focus on the listed RAID levels.

RAID 1

This RAID level is most commonly seen in servers for the OS and application files. RAID 1 is a mirrored pair of disks. Every write is mirrored so the speed of the write speed is equal to one disk. The write penalty on a RAID 1 volume is 2. Reads however are coming from both disks simultaneously. If one disk fails then the other disk will continue to respond to the read and write (I/O) requests. The broken disk can be replace on-line and will usually start the sync data from the good disk. This is called a rebuild.

RAID 5

RAID 5 is usually used for larger volumes where write speed is not very important. Three or more disks are members of the array. If you have 3 900GB drives the net capacity will be 1800GB. The capacity of one drive is subtracted. That space is used for parity blocks. Please note that the parity blocks do not reside on that disk though. There are evenly distributed as shown in the simple table below.

disk 0 disk 1 disk 2
data data parity
data parity data
parity data data

The write penalty here is determined by what one write I/O causes. The old data and the parity belonging to it must be read. Then the new data and the parity must be written. Counting the IO actions, 2 reads and 2 writes, leads to 4. That results in a write penalty on a RAID 5 volume of 4.

RAID 1+0

This RAID level is commonly used in scenarios where you would want to have the most redundancy and the lowest write penalty. Data is striped and the mirrored. Usually database files are stored on such type if volumes. However, this results in half the net storage capacity. To get a net 1.8TB volume you would need 4 900GB drives.

Performance and write penalty

Now that we have covered the basics of the most commonly used RAID levels I will dive a little further into the performance of each RAID level. As you have read, I touched upon the write penalties. In all three levels (1, 5 and 1+0) reads are coming from all disks. The speed of the writes are depending on the write penalties.

The following tabels summarized the RAID levels, minimal number of disks and their write penalties.

RAID level Minimum # disks Write penalty
RAID 1 2 (max) 2
RAID 5 3 4
RAID 1+0 4 2

If a disk can deliver 180 I/O per second (based on the average seek time and the rotational delay) then if you have just 1 disk your maximum random writes (in a 100% write scenario) would be limited to 180 IOPS. If you have a RAID 1 array, and therefor 2 disks with a combined performance op 2*180=360 random IOPS then you would need to divide that by the write penalty. So, on a RAID 1 array you will have 360 random IOPS in a 100% read scenario and 180 random IOPS in a 100% write scenario.

With RAID 5 you would need at least 3 disks. Here it would be 3*180=540 IOPS. Now divide that by the RAID 5 write penalty which is 4 you would end up having 540/4=135 random write IOPS in a 100% write scenario. But each time you add a disk the performance increases.

At RAID 1+0 the write penalty is the same as RAID level 1 but you need at least 4 disks. The maximum number of random write IOPS in a 100% write scenario would then be (4*180)/2=360. Now, if you would have 8 disks in a RAID 1+0 array you would end up with (8*180)/2=720 random IOPS.

To conclude this post, lets compare RAID 5 and RAID 1+0 in the following graph using the same amount of disks

Quite a big difference...

Perhaps I should write up some examples on how to create a software based RAID in Linux in a future post. Fun!

No comments:

Post a Comment

How to create a software RAID array in Linux | mdadm

In my previous post I explained on the most common used RAID levels and their write penalties. In this post I will show how you c...