Copyright, Harris Corporation & Ophir Frieder, 19982 Objectives Define the various RAID configurations & levels. Discuss advantages and disadvantages of the various RAID configurations.
Copyright, Harris Corporation & Ophir Frieder, 19983 What Is RAID? Redundant Arrays of Inexpensive Disks (RAID) –Informally referred to as disk arrays. Proposed in the 1980s as a way to use parallelism between multiple disks to improve aggregate I/O performance, reliability, or both. –Provides load balancing across disks, thereby eliminating hot spots. –Higher transfer rates for large data accesses. –Higher I/O rates on small data accesses.
Copyright, Harris Corporation & Ophir Frieder, 19984 Just A Bunch Of Disks In a traditional database environment, multiple disks are used to obtain improvements in performance and reliability. –Mirroring. –Horizontal partitioning (striping). –Balancing I/O and eliminating contention. –Isolating high and low level activity tables and indices. Traditionally, distributing and managing data on multiple disks is manually performed by a DBA or system developer.
Copyright, Harris Corporation & Ophir Frieder, 19985 RAID Similarly RAID obtains improvements in performance and reliability by spreading data across a collection of disks called a disk array. However, with RAID the distribution and management of data is performed by a RAID controller. Individual Disks
Copyright, Harris Corporation & Ophir Frieder, 19986 RAID Levels RAID based systems allow data to be distributed across the disk array in a variety of different ways called levels. Some levels provide improvements in performance, other provide improvements in reliability, while others provide both. The various RAID levels do have costs.
Copyright, Harris Corporation & Ophir Frieder, 19987 RAID Level 0: Striping With a RAID level 0 organization, the data in a table or logical volume is spread evenly across all of the array disks. The table or logical volume is divided into blocks. Blocks are assigned to disks by rotation; block #1 goes on disk #1, block #2 goes on disk #2, etc., ultimately wrapping back around if necessary. Block size is also called the chunk size, and the number of disks is called the stripe width.
Copyright, Harris Corporation & Ophir Frieder, 19988 RAID Level 0, Cont. Steps for processing a request for data larger than a single chunk: –Request is broken into a set of smaller physical requests. –Individual requests are dispatched serially. –Individual requests are serviced by multiple disks concurrently. –Results of individual requests are reassembled into a logical I/O buffer.
Copyright, Harris Corporation & Ophir Frieder, 19989 Performance Of RAID Level 0 Generally, striping will improve the performance of an individual request that: –Requires data larger than a single chunk. –Is primarily sequential, i.e., where transfer time dominates access (seek and rotation) time. Generally, striping will not improve performance: –For a single small request that randomly accesses data, i.e., where head seek time and disk rotation time dominate transfer time. –When chunk size is too small (less than 4-8 KB), since the overhead of processing each chunk becomes too large.
Copyright, Harris Corporation & Ophir Frieder, 199810 Performance Of RAID Level 0 Striping can improve overall disk I/O throughput in environments dominated by small concurrent random I/Os. –The single vs. multiple checkout line phenomena, i.e., reduces disk utilization and disk queue usage.
Copyright, Harris Corporation & Ophir Frieder, 199811 RAID Level 1: Data Redundancy/Mirroring With RAID Level 0, all disks must function properly; if one fails, the entire device becomes unusable. RAID Level 1 avoids this by duplicating the contents of every disk. The main drawback is that it requires twice the amount of required space.
Copyright, Harris Corporation & Ophir Frieder, 199812 Performance Of RAID Level 1 Reads: –An individual read is not improved at all. –Concurrent reads are improved by reducing disk utilization. Concurrent reads can be dispatched serially and serviced concurrently. Concurrent reads to the same disk can even be improved by alternating between identical disks. Writes: –Each logical write must be duplicated. –The two writes can be dispatched serially and serviced concurrently. –Typically, this takes 15-20% longer than a non-mirrored write.
Copyright, Harris Corporation & Ophir Frieder, 199813 RAID Level 0+1: Making Mirroring More Flexible In this RAID configuration, mirroring and striping are combined. Sequential reads are improved through striping. Small, concurrent, random reads are improved through the use of multiple disks. Writes degrade by 15-20%.
Copyright, Harris Corporation & Ophir Frieder, 199814 RAID Level 2: Parity Check Disk striping at the bit-level. Also makes use of one or more disks to store parity information. Not used very often because it is considered slow and inexpensive.
Copyright, Harris Corporation & Ophir Frieder, 199815 RAID Level 3: Parity Check Makes use of a reversible parity function. Let the blocks for a stripe be b 1,b 2,...,b n. Then the corresponding parity block is defined as: p = b 1 xor b 2 xor... xor b n Given all but one of the n blocks, in addition to the parity block p, the missing block can be computed. Typically, the block size is one byte or word. Computing the parity is relatively cheap, requiring less than a millisecond.
Copyright, Harris Corporation & Ophir Frieder, 199816 RAID Level 3: Parity Check, Cont. For a 4 disk wide stripe, the data and parity blocks would be arranged as follows: disk #1disk #2disk #3disk #4 b1b2b3parity0 b4b5b6parity1 b7b8b9parity2
Copyright, Harris Corporation & Ophir Frieder, 199817 Performance Of RAID Level 3 Reads: –For most implementations, reads do not require access to the parity data, unless there is an error reading from one of the other disks. –However, even small concurrent reads are not improved since virtually every disk is involved in every read since the chunk size is relatively small, i.e., a byte or word. –Performance for an individual sequential read is maximized when the I/O request size is a multiple of the stripe size. Writes: –Every write involves accessing the data block(s) to be written, and the parity disk, thus requiring at least two reads and at least two writes! –For concurrent writes, the parity disk also becomes a bottleneck.
Copyright, Harris Corporation & Ophir Frieder, 199818 RAID Level 4: Independent Access Typically the chunk size for RAID Level 3 is one byte or word; thus every disk is involved in virtually every I/O. With RAID Level 4, the chunk size is larger, and typically equal to the size of a disk sector or disk I/O size. Enables small I/O operations to be satisfied by individual disks. Still suffers from the single parity disk bottleneck.
Copyright, Harris Corporation & Ophir Frieder, 199819 RAID Level 5: Rotational Parity The same as RAID Level 4, but with parity information distributed among the disks. disk #1disk #2disk #3disk #4 b1b2b3parity0 b4b5parity1b6 b7parity2b8b9
Copyright, Harris Corporation & Ophir Frieder, 199820 Performance Of RAID Level 5 Reads: –As with RAID Level 4, sequential read performance is maximized when the I/O request size is a multiple of the stripe size. –Handles sequential reads just as efficiently as RAID Level 0. Writes: –As with RAID Level 4, every write involves at least two reads and at least two writes. –In practice, writing for RAID Level 5 is much worse...
Copyright, Harris Corporation & Ophir Frieder, 199821 Performance Of RAID Level 5, Cont. Loss of data integrity: –Consider a situation where a block is written, and the system fails before the parity data is written. Solution: Two-phase commit via a transaction log: –All required data blocks are read at the beginning of a write. –The new parity block is computed. –The modified data and parity blocks are written to the log. –The modified data and parity blocks are written to their respective disks. –The log entry is removed.
Copyright, Harris Corporation & Ophir Frieder, 199822 Performance Of RAID Level 5, Cont. Requires at least two reads, at least two log writes, one write of the parity data, and at least one write of the actual data! Typically, this results in a a 60% increase in actual I/O time!
Copyright, Harris Corporation & Ophir Frieder, 199823 Failure In The Context Of RAID RAID Level 0 (striping) –Complete failure if any disk fails. RAID Level 1 (mirroring) –If a disk fails, then it is taken off-line, and all access goes to the surviving sub-mirror until it is brought back on-line. RAID Level 0+1 (striping and mirroring) –The same as RAID Level 1.
Copyright, Harris Corporation & Ophir Frieder, 199824 Failure In The Context Of RAID, Cont. RAID Level 3 & 5 (one parity disk) –If a disk fails, every block in the stripe must be read to regenerate using the parity block, e.g., a 30 disk wide stripe would require 29 physical I/O operations. It is typical to limit the width of a RAID volume to approximately 6 disks.
Copyright, Harris Corporation & Ophir Frieder, 199826 Conclusions Each of the RAID levels has advantages and disadvantages, and there is no panacea. RAID volumes can be mixed and matched in a single configuration, where different volumes are used for different purposes. Examples: –In a heavily accessed DSS application with big tables, mirroring is probably too expensive, so RAID Level 5 is probably appropriate. –Sort and temporary areas in a DSS application could use RAID Levels 0 or 0+1, since their results are transitory. –In most OLTP environments, RAID Level 5 should be avoided.
Copyright, Harris Corporation & Ophir Frieder, 199827 Conclusions, Cont. Note the (familiar) trade-off between reliability and performance. Most vendors do not implement RAID Levels 2, 3, or 4, since RAID Level 5 efficiently addresses their shortcomings.