Storage RAID Levels

Disk RAID Levels

RAID stands for Redundant Array of Independent Disks. It is a technique that uses a combination of multiple disks instead of using a single disk for increased performance, data redundancy or both. The term RAID was coined in 1987 by David Patterson, Randy Katz and Garth A. Gibson. In their 1988 technical report, "A Case for Redundant Arrays of Inexpensive Disks (RAID)," the three argued that an array of inexpensive drives could beat the performance of the top disk drives of the time. By utilizing redundancy, a RAID array could be more reliable than any one disk drive.

The different schemes, or data distribution layouts, are named by the word "RAID" followed by a number, for example RAID 0 or RAID 1. RAID works by placing data on multiple disks and allowing input/output (I/O) operations to overlap in a balanced way, improving performance and by performance I mean disk write performance. Disk read performance will be approximately same across all RAID types. RAID arrays appear to the operating system (OS) as a single logical hard disk.

RAID Levels are evaluated based on the following points

  • Fault Tolerance - Means if the system is able to recover data or has a backup system in case of failure.
  • Performance - Which RAID is the fastest which is the slowest?
  • Storage - Are we able to use the entire available capacity of the disks?

Different RAID Levels

  • RAID 0
  • RAID 1
  • RAID 5
  • RAID 6
  • RAID 10

RAID 0

Key Points in RAID 0:

  • Block level stripping without parity or mirroring
  • No redundancy

What does it mean? Let’s go a bit deeper here with an example. Let us assume that we have a RAID comprising of 2 DISKS with 1MB block size and let’s assume that it takes 1 sec to write it on to a disk. Stripping will break it into 2 parts. 1st part will go to the first disk and 2nd part will go to the second disk. Both disks starts writing at the same time and so the writing time is halved.

Suppose we have 4 disks instead of 2, then we can break 1MB into 4 parts and 4 writes will happen parallel. So, write time is now 1/4th.

So, to sum up, the more disks we have, more parallel IO per sec (IOPS) happens and RAID becomes faster.

Let us evaluate RAID 0 based on the 3 key points we had mentioned earlier:

  • Performance: RAID 0 is always the highest performing level. RAID 0 is the easiest  level to understand because there is effectively no overhead to worry about, no resources consumed to power it and both read and write get the full benefit of every spindle, all of the time. So for RAID 0 the effective write performance is NX. An example would be an eight spindle RAID 0 array. If an individual drive in the array delivers 125 IOPS then our calculation would be from N = 8 and X = 125 so 8 * 125 yielding 1,000 IOPS. Both read and write IOPS are the same here. So it is extremely simple as we get 1K RIOPS, 1K WIOPS and 1K with any blending thereof—very simple.
  • Fault tolerance: Since already mentioned that it doesn’t use parity or mirroring i.e. no backup system. So, no fault tolerance, if one disk is corrupted then loss of entire data. The more the number of drives, the more is the likelihood of failure.
  • Storage Space: 100% i.e. 2 Disks of 50GB in RAID 0 gives us 100GB of storage.

RAID 1

Key Points in RAID 1:

  • Mirroring without parity and stripping.

Let us assume that we have a RAID comprising of 2 DISKS with 1 sec per block write speed. Here the exact same data is written into both disks in parallel. The write performance depends on slower of the two drives. Also we must have disks in powers of 2 i.e. 2, 4, 8 and so on because we need to replicate the data for each disk. This array continues to function as long as one drive is up and functioning.

Let us evaluate RAID 1 based on the 3 key points:

  • Performance: Fast compared to RAID 5 and 6 but slow compared to RAID 0. In RAID 1 each mirror has to write the same data twice in order to create the mirroring. This cuts our write performance in half compared to a RAID 0 array of the same number of drives. Giving us effective write performance of NX/2. We should note that at the same capacity, rather than the same number of spindles, RAID 1 has the same write performance as RAID 0 but double the read performance – simply because it requires twice as many spindles to match the same capacity. So an eight spindle RAID 10 array would be N = 8 and X = 125 and our resulting calculation comes out to be (8 * 125)/2 which is 500 WIOPS. A 50/50 blend would result in 750 Blended IOPS (1,000 Read IOPS and 500 Write IOPS).
  • Fault tolerance: Mirror
  • Storage: 50%. If we have 2 disks, one will be used for mirroring.

If one disk fails the end user doesn’t know it, as failure has no impact. When we replace the corrupted disk with a new one, all the RAID is going to do is copy and paste. From the previous example where we considered the write speed as 1 sec per block, here write speed will be exactly 1 sec, same as time needed to write 1 block.

RAID 5

Key Points in RAID 5:

  • Block level stripping with distributed parity

What actually happens in RAID 5 is that is it breaks the block of data into 3 parts and the fourth part comprises of compressed form of the other three data. This is achieved through compression algorithms. Eg: 10110110011 -> 10A0A00A - > 1BB0B. The parity block is distributed so that it can tolerate the failure of 1 drive. When 1 disk is failing then the performance will be slow as the other disks have to show their own data + they have to reconstruct the lost data to be presented to the end user. RAID 5 requires at least 3 disks.

Let us evaluate RAID 5 based on the 3 key points:

  • Performance: Slow. Parity RAID adds a somewhat complicated need to verify and re-write parity with every write that goes to disk. This means that a RAID 5 array will have to read the data, read the parity, write the data, and finally write the parity. Four operations for each effective one. This gives us a write penalty on RAID 5 of four. So the formula for RAID 5 effective write performance is NX/4.So following the eight spindle example where the write IOPS of an individual spindle is 125 we would get the following calculation: (8 * 125)/4 which comes to 250 WIOPS. In a 50/50 blend this would result in 625 Blended IOPS(1000 Read IOPS and 250 Write IOPS).
  • Fault Tolerance: Parity. If one disk has failed, then it can reconstruct the data from the remaining 2 blocks in the other disks + the parity. Can lose up to one disk.
  • Storage Space: Total Disks – 1 Disk. 1 Disk will be completely used for storing parity data.

When we install a new disk to replace the failed one, there is no simple copy and paste. Instead it has to do reverse computations and then write the data, which will take a lot of time unlike in RAID 1 which is simple copy and paste. Also in RAID 5 if we have a store of 8GB with 4 Disks of 2GB each, on failure of one the time to recuperate is higher and also performance is low. So it is good to have a large number of Disks with smaller capacity so that recuperation is faster like having 10 DISKs with 1GB each.

RAID 6

Key Points in RAID 6:

  • Block level striping with double fault tolerance

In RAID 6 we have a parity of the data, just like RAID 5 + the copy of the parity. The 1st parity will be distributed across the disks and the copy will be stored in a single dedicated disk.

Let us evaluate RAID 6 based on the 3 key points:

  • Performance: Slow. Each write operation requires the disks to read the data, read the first parity, read the second parity, write the data, write the first parity and then finally write the second parity. This comes out to be a six times write penalty, which is pretty dramatic. So the effective write performance is NX/6.Continuing our example we get (8 * 125)/6 which comes out to ~167 Write IOPS. In our 50/50 blend example this is a performance of 583.5 Blended IOPS(1000 Read IOPS and 166.6 Write IOPS).  As you can see, parity writes cause a very rapid decrease in write performance and a noticeable drop in blended performance.
  • Fault tolerance: Parity with double fault tolerance. Can allow fault tolerance up to 2 failed DISKs. This is useful for high availability systems.
  • Storage space: Total Disks – 2 Disks. 2 Disk will be completely used for storing parity data.

When 1 Disk is failing then the performance will be slow as the other Disks have to show their own data + they have to reconstruct the lost data to be presented to the end user.

RAID 10

This RAID is often referred to as 1+0 or 0+1

Key Points in RAID 10:

  • Mirroring and Stripping

Here in this RAID configuration data written in stripes in primary disk are mirrored in secondary disks. We take data, stipe it in blocks and write parallel across disks. After that we create a backup of the stripped data as it is RAID 1 on top of that.

Let us evaluate RAID 10 based on the 3 key points:

  • Performance: Fast compared to RAID 5 and 6 but slow compared to RAID 0. Because RAID 10 is a RAID 0 stripe of mirror sets, we have no overhead to worry about from the stripe but each mirror has to write the same data twice in order to create the mirroring. This cuts our write performance in half compared to a RAID 0 array of the same number of drives. Giving us a effective write performance of NX/2. We should note that at the same capacity, rather than the same number of spindles, RAID 10 has the same write performance as RAID 0 but double the read performance – simply because it requires twice as many spindles to match the same capacity. So an eight spindle RAID 10 array would be N = 8 and X = 125 and our resulting calculation comes out to be (8 * 125)/2 which is 500 WIOPS. A 50/50 blend would result in 750 Blended IOPS (1,000 Read IOPS and 500 Write IOPS).
  • Fault tolerance: Mirroring.
  • Storage: 50%. If we have 4 disks, 2 will be used for mirroring.

Here we can lose two Disks as long as it is not its mirrored set. Ex: - We can lose A & D, B & C, A & B or C & D. But we cannot afford to lose A & C or B & D. Performance does not degrade on failure of one and rebuild will take exactly 1 sec as it will directly copy.

General concept on all RAID types

The three parameters in choosing RAID level can be shown as

  • Every disk should be of identical configuration. This means that they should have the same size, same RPM. Because if 1 has 7200 RPM and other has 5400 RPM then they both will throttle down to 5400 RPM. So, no point in having one disk with higher value of RPM.
  • One should not buy same configuration disks for RAID from the same vendor as they might have the same manufacturing date. So, probability is high that they might expire at the same time which might lead to loss of data.