27
Copyright, Harris Corporation & Ophir Frieder, 1998 1 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Embed Size (px)

Citation preview

Page 1: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 19981

Redundant Arrays ofInexpensive Disks

(RAID)

Page 2: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 19982

Objectives

• Define the various RAID configurations & levels.

• Discuss advantages and disadvantages of the various RAID configurations.

Page 3: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 19983

What Is RAID?

• Redundant Arrays of Inexpensive Disks (RAID)– Informally referred to as “disk arrays.”

• Proposed in the 1980’s 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.

Page 4: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 5: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

IndividualDisks

Page 6: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 7: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 8: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 9: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 19989

Performance OfRAID 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.

Page 10: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199810

Performance OfRAID 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.

Page 11: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 12: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199812

Performance OfRAID 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.

Page 13: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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%.

Page 14: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 15: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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 b1,b2,...,bn. Then the corresponding parity block is defined as:

p = b1 xor b2 xor ... xor bn

• 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.

Page 16: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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 #1 disk #2 disk #3 disk #4b1 b2 b3 parity0b4 b5 b6 parity1b7 b8 b9 parity2

Page 17: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199817

Performance OfRAID 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.

Page 18: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 19: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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 #1 disk #2 disk #3 disk #4b1 b2 b3 parity0b4 b5 parity1 b6b7 parity2 b8 b9

Page 20: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199820

Performance OfRAID 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...

Page 21: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199821

Performance OfRAID 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.

Page 22: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199822

Performance OfRAID 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!

Page 23: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199823

Failure In The ContextOf 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.

Page 24: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199824

Failure In The ContextOf 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.

Page 25: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

Copyright, Harris Corporation &

Ophir Frieder, 199825

Summary - Advantages and Disadvantages

0 Reduces disk utilization for: A single large sequential transfer. Environments dominated by small, concurrent,

random I/Os which can each be serviced by asingle disk (also reduces disk queue length in thiscase)

Complete failure if any disk fails.

1 Tolerant of single, and even multiple disk failure. Reduces disk utilization for:

Concurrent reads to different disks. Concurrent reads to the same disk by submitting

reads alternatively to identical disks.

Uses twice the amount of space. Each logical write requires two physical writes;

issued serially, processed concurrently.

0+1 Same as for Level 1, but also reduces disk utilizationfor large sequential transfers.

Same as Level 1.

3 Tolerant of single disk failure. May reduce disk utilization for a single large

sequential transfer, depending on chunk size.

Requires one additional disk. Every logical write requires the parity information be

read and re-written. Parity disk becomes a bottleneck when concurrent

writes occur frequently. Every disk is involved in virtually every I/O, thereby

reducing the number of concurrent I/Os.

4 Same as Level 0. Same as Level 3, except every disk is not necessarilyinvolved in every I/O.

5 Same as Level 4. Same as Level 3, but parity disk is no longer abottl.eneck.

Page 26: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.

Page 27: Copyright, Harris Corporation & Ophir Frieder, 19981 Redundant Arrays of Inexpensive Disks (RAID)

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.