Tuesday, 1 August 2017

Understanding RAID Performance at Various Levels

Choosing a RAID level is an exercise in balancing many factors including cost, reliability, capacity, and of course, performance.

RAID performance can be difficult to understand, especially as distinct RAID levels use varying techniques and behave rather differently in practice. In this article, I want to explore the common RAID levels of RAID 0, 5, 6, and 10 to see how performance differs between them.

For the purposes of this article, RAID 1 will be assumed to be a subset of RAID 10.  This is often a handy way to think of RAID 1—as simply being a RAID 10 array with only a single mirrored pair member. As RAID 1 is truly a single pair RAID 10 and behaves as such, this works wonderfully for making RAID performance easy to understand. It simply maps into the RAID 10 performance curve.

Computer Hard Disk Drive Internals And Binary Number Code

RAID Reading, Writing 101


There are two types of performance to look at with all storage: reading and writing. In terms of RAID, reading is extremely easy and writing is rather complex. Read performance is effectively stable across all types. Writing, however, is not.

To make discussing performance easier we need to define a few terms as we will be working with some equations. In our discussions we will use “N” to represent the total number of drives, often referred to as spindles, in our array. We will use “X” to refer to the performance of each drive individually. This allows us to talk in terms of relative performance as a factor of the drive performanc. We can abstract away the RAID array and not have to think in terms of raw IOPS (Input/Output Operations Per Second). This is important as IOPS are often very hard to define. But we can compare performance in a meaningful way by speaking to it in relationship to the individual drives within the array.

It’s also important to remember that we are only talking about the performance of the array itself, not an entire storage subsystem. Artifacts such as memory caches and solid state caches will do amazing things to alter the overall performance of a storage subsystem. But they will not fundamentally change the performance of the  array itself under the hood. There is no simple formula for determining how different cache options will impact the overall performance. Suffice it to say that it can be very dramatic depending heavily not only on the cache choices themselves, but also heavily on workload. Even the biggest, fastest, most robust cache options cannot change the long term, sustained performance of an array.

RAID is complex and many factors influence the final performance. One is the implementation of the system itself. A poor implementation might cause latency. Or it may fail to use the available spindles (such as having a RAID 1 array read only from a single disk instead of from both simultaneously!) There is no easy way to account for deficiencies in specific implementations. We must assume that all are working to the limits of the specification. Any enterprise RAID system will do this. It is primarily hobby and consumer RAID systems that fail in this aspect.

The CPU’s Role In RAID Performance


Some types of RAID also have dramatic amounts of computational overhead associated with them while others do not. Primarily, parity RAID levels require heavy processing in order to handle write operations, with different levels having different amounts of computation necessary for each operation. This introduces latency, but does not curtail throughput. This latency will vary, however, based on the implementation of the RAID level as well as on the processing capability of the system.

Hardware RAID will use something like a general purpose CPU (often a Power or ARM RISC processor) or a custom ASIC to handle this. Software RAID hands this off to the server’s own CPU. Often, the server CPU is actually faster here but consumes system resources. ASICs can be very fast but are expensive to produce. This latency impacts storage performance but is very difficult to predict and can vary from nominal to dramatic. So I will mention the relative latency impact with each RAID level but will not attempt to measure it. In most RAID performance calculations, this latency is ignored. However, it is still present. Depending on the configuration of the array, it could have a noticeable impact on a workload.

There is, it should be mentioned, a tiny performance impact to read operations due to efficiencies in the layout of data on the disk itself. Parity RAID requires there to be data on the disks that is useless during a healthy read operation but cannot be used to speed it up. This actually results in it being slightly slower. But this impact is ridiculously small and is normally not measured and so can be ignored.

Factors such as stripe size also impact performance, of course. But as that is configurable and not an intrinsic artifact in any level, I will ignore it here. It is not a factor when choosing a RAID level itself but only in configuring one once chosen.

Closeup on data servers while working. Blue LED lights are flashing. Image can represent cloud computing, information storage, etc. or can be the perfect technology background.

Read/Write Ratio For Storage


The final factor that I want to mention is the read to write ratio of storage operations. Some RAID arrays will be used almost purely for read operations, some almost solely for write operations. Most will use a blend of the two, likely something around eighty percent read and twenty percent write. This ratio is very important in understanding the performance that you will get from your specific array and understanding how each RAID level will impact you. I refer to this as the read/write blend.

We measure storage performance primarily in IOPS. IOPS stands for Input/Output Operations Per Second (yes, I know that the letters don’t line up well, but it is what it is.) I further use the terms RIOPS for Read IOPS, WIOPS for Write IOPS and BIOPS for Blended IOPS which would come with a ratio of 80/20 or whatever. Many people talk about storage performance with a single IOPS number. When this is done they normally mean Blended IOPS at 50/50. However, rarely does any workload run at 50/50 so that number can be extremely misleading. We need two numbers, RIOPS and WIOPS to understand performance. We can use these two together can to find any IOPS blend that we need.  For example, a 50/50 blend is as simple as (RIOPS * .5) + (WIOPS * .5). The more common 80/20 blend would be (RIOPS * .8) + (WIOPS * .2).

Now that we have established some criteria and background understanding, we will delve into our RAID levels themselves and see how performance varies across them.

For all RAID levels, we calculate the Read IOPS number using NX. This does not address the nominal overhead numbers that I mention above, of course. This is a “best case” number. But the real world number is so close that it is very practical to simply use this formula. Simply take the number of spindles (N) and multiply by the IOPS performance of an individual drive (X). Keep in mind that drives often have different read and write performance. So be sure to use the drives Read IOPS rating or tested speed for the Read IOPS calculation and the Write IOPS rate or tested speed for the Write IOPS calculation.

Read More: Practical RAID Decision-Making

RAID 0 Performance


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 our formula for write performance is very simple: NX. RAID 0 is always the highest performing level.

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. If we didn’t know the absolute IOPS of an individual spindle, we could refer to an eight spindle RAID 0 as delivering 8X Blended IOPS.

RAID 10 Performance


RAID 10 has the second simplest level to calculate. 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 write performance formula of simply: NX/2 or .5NX.

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 or 4X WIOPS. A 50/50 blend would result in 750 Blended IOPS (1,000 Read IOPS and 500 Write IOPS.)

This formula applies to RAID 1, RAID 10, RAID 100 and RAID 01 equally.

Uncommon options such as triple mirroring in RAID 10 would alter this write penalty. RAID 10 with triple mirroring would be NX/3, for example.

Read More: Understanding and Using RAID 10

RAID 5 Performance


RAID 5 is deprecated and should never be used in new arrays. I include it here because it is a well-known and commonly-used RAID level and its performance needs to be understood. RAID 5 is the most basic of the modern parity RAID levels. RAID 2, 3 & 4 are no longer found in production systems and so we will not look into their performance here. RAID 5, while not recommended for use today, is the foundation of other modern parity RAID levels so is important to understand.

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 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 or 2X Write IOPS which comes to 250 WIOPS. In a 50/50 blend this would result in 625 Blended IOPS.

RAID 6 Performance


RAID 6, after RAID 10, is probably the most common and useful RAID level in use today. RAID 6, however, is based off of RAID 5 and has another level of parity. This makes it dramatically safer than RAID 5, which is very important, but also imposes a dramatic write penalty. 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 our formula is NX/6.

Continuing our example we get (8 * 125)/6 which comes out to ~167 Write IOPS or 1.33X. In our 50/50 blend example this is a performance of 583.5 Blended IOPS. As you can see, parity writes cause a very rapid decrease in write performance and a noticeable drop in blended performance.

RAID 7 (aka RAID 5.3 or RAID 7.3) Performance


RAID 7 is a somewhat non-standard level with triple parity based off of the existing single parity of RAID 5 and the existing double parity of RAID 6. The only current implementation of RAID 7 is ZFS’ RAIDZ3. Because RAID 7 contains all of the overhead of both RAID 5 and RAID 6 plus the additional overhead of the third parity component we have a write penalty of a staggering eight times. So our formula for finding RAID 7 write performance is NX/8.

In our example this would mean that (8 * 125)/8 would come out to 125 Write IOPS or 1X. So with eight drives in our array we would get only the write performance of a single, stand-alone drive. That is significant overhead. Our blended 50/50 IOPS would come out to only 562.5.

Read More: Why RAID is Not a Backup

Complex RAID Performance


Complex RAID levels or Nested RAID levels such as RAID 50, 60, 61, 16, etc. can be found using the information above. You can break the RAID down into its components and apply the formulae provided above. There is no simple formula for these levels because they have varying configurations. It is necessary to break them down into their components and apply the formulae multiple times.

RAID 60 with twelve drives, two sets of six drives, where each drive is 150 IOPS would be done with two RAID 6s. It would be the NX of RAID 0 where N is two (for two RAID 6 arrays) and the X is the resultant performance of each RAID 6.  Each RAID 6 set would be (6 * 150)/6. So the full array would be 2((6 * 150)/6). Which results in 300 Write IOPS.

The same example as above but configured as RAID 61, a mirrored pair of RAID 6 arrays, would be the same performance per RAID 6 array, but applied to the RAID 1 formula which is NX/2 (where X is the resultant performance of the each RAID array.) So the final formula would be 2((6 * 150)/6)/2 coming to 150 Write IOPS from twelve drives.

Programming code abstract technology background of software developer and Computer script

Performance as a Factor of Capacity


When we are producing RAID performance formulae we think of these in terms of the number of spindles, which is incredibly sensible. This is very useful in determining the performance of a proposed array or even an existing one where measurement is not possible and allows us to compare the relative performance between different proposed options. It is in these terms that we universally think of RAID performance.

This is not always a good approach, however, because typically we look at RAID as a factor of capacity rather than of performance or spindle count. It would be very rare, but certainly possible, that someone would consider an eight drive RAID 6 array versus an eight drive RAID 10 array. Once in a while this will occur due to a chassis limitation or some other, similar reason. But typically we view RAID arrays from the standpoint of total array capacity (e.g. capacity we can use) rather than spindle count, performance or any other factor. It is odd, therefore, that we should then switch to viewing RAID performance as a function of spindle count.

If we change our viewpoint and pivot upon capacity as the common factor, while still assuming that individual drive capacity and performance (X) remains constant between comparators then we arrive at a completely different landscape of performance. In doing this we see, for example, that RAID 0 is no longer the most performant RAID level and that read performance varies dramatically instead of being a constant.

Capacity is a fickle thing but we can distill it to the number of spindles necessary to reach desired capacity. This makes this discussion far easier. So our first step is to determine our spindle count needed for raw capacity. If we need a capacity of 10TB and are using 1TB drives, we would need ten spindles, for example. Or if we need 3.2TB and are using 600GB drives we would need six spindles. We will, different than before, refer to our spindle count as “R.” As before, performance of the individual drive is represented as “X.” (“R” is used here to denote that this is the Raw Capacity Count, rather than the total number of spindles.)

RAID 0 remains simple. Performance is still RX as there are no additional drives. Both read and write IOPS are simply NX.

RAID 10 has RX Write IOPS but 2RX Read IOPS. This is dramatic. Suddenly when viewing performance as a factor of stable capacity we find that RAID 10 has double read performance over RAID 0!

RAID 5 gets slightly trickier. Write IOPS would be expressed as ((R + 1) * X)/4. The Read IOPS are expressed as ((R +1) * X).

RAID 6, as we expect, follows the pattern that RAID 5 projects. Write IOPS for RAID 6 are ((R + 2) * X)/6. And the Read IOPS are expressed as ((R + 2) * X).

RAID 7 falls right in line. RAID 7 Write IOPS would be ((R + 3) * X)/8. And the Read IOPS are ((R + 3) * X).

This vantage point changes the way that we think about performance and, when looking purely at read performance, RAID 0 becomes the slowest RAID level rather than the fastest and RAID 10 becomes the fastest for both read and write no matter what the values are for R and X!

Let’s take a real world example of 10 2TB drives to achieve 20TB of usable capacity with each drive having 100 IOPS of performance and assume a 50/50 blend. The resultant IOPS would be: RAID 0 with 1,000 Blended IOPS, RAID 10 with 1,500 Blended IOPS (2,000 RIOPS / 1,000 WIOPS), RAID 5 with 687.5 Blended IOPS (1,100 RIOPS / 275 WIOPS), RAID 6 with 700 Blended IOPS (1,200 RIOPS / 200 WIOPS) and finally RAID 7 with 731.25 Blended IOPS (1,300 RIOPS / 162.5 WIOPS.) RAID 10 is a dramatic winner here.

Latency and System Impact with Software RAID


As I have stated earlier, RAID 0 and RAID 10 have, effectively, no system overhead to consider. The mirroring operation requires essentially no computational effort and is, for all intents and purposes, immeasurably small. Parity RAID does have computational overhead and this results in latency at the storage layer and system resources being consumed. Of course, if we are using hardware RAID those resources are dedicated to the RAID array. They have no function but to be consumed in this role. If we are using software RAID, however, these are general purpose system resources (primarily CPU) that are consumed for the purposes of the RAID array processing.

The impact to even a very small system with a large amount of RAID is still very small but it can be measured and should be considered, if only lightly. Latency and system impact are directly related to one another.

There is no simple way to state latency and system impact for different levels. Here’s one way we can put it:
  • RAID 0 and RAID 10 have effectively no latency or impact.

  • RAID 5 has some latency and impact

  • RAID 6 has roughly twice as much computational latency and impact as RAID 5

  • RAID 7 has roughly triple the computational latency and impact as RAID 5


In many cases this latency and system impact will be so small that they cannot be measured with standard system tools. As modern processors become increasingly powerful, the latency and system impact will continue to diminish. Impact has been considered negligible for RAID 5 and RAID 6 systems on even low-end, commodity hardware since approximately 2001. On heavily loaded systems with a large amount of parity RAID activity, there could be contention between the RAID subsystem and other processes requiring system resources.

raid 5 vs raid 0 performance, raid 5 vs raid 0 read performance, raid 5 vs raid 0+1
Source: http://docphy.com/technology/computers/software/understanding-raid-performance-various-levels.html

No comments:

Post a Comment