320 likes | 450 Views
Storage Refinement. Outline. Disk failures To attack Intermittent failures To attack Media Decay and Write failure Checksum To attack Disk crash RAID. Disk Failures. Partial Total Intermittent Permanent. Disk failures. Intermittent failure
E N D
Outline • Disk failures • To attack Intermittent failures • To attack Media Decay and Write failure • Checksum • To attack Disk crash • RAID
Disk Failures • Partial Total • Intermittent Permanent
Disk failures • Intermittent failure • Repeated tries will be successful • Media decay • A bit or bits are permanently corrupted • Write failure • Neither can we write successfully, nor can we retrieve the previous written sector • Disk crash • The entire disk becomes unreadable, suddenly and permanently
Coping with Disk Failures • Detection • e.g. Checksum • Correction Redundancy
Outline • Disk failures • To attack Intermittent failures • To attack Media Decay and Write failure • Checksum • To attack Disk crash • RAID
Intermittent failures • Reading function returns (w,s) • W: data • S: status • If s is bad, repeat reading enough times
Outline • Disk failures • To attack Intermittent failures • To attack Media Decay and Write failure • Checksum • Stable storage • To attack Disk crash • RAID
Checksums • Parity check • Even 1’s • For example: 01101000-> parity bit is 1 • Any one bit error in reading or writing can be detected • Even bits errors can not be detected
Logical Block Copy A Copy B Stable storage • Basic idea • Sectors are paired and represent the same sector-contents • Error-handling capabilities • Media failure • Except that both copy failed, which is rare • Write failure
Notes 2 At what level do we cope? • Single Disk • e.g., Error Correcting Codes • Disk Array Logical Physical
Outline • Disk failures • To attack Intermittent failures • To attack Media Decay and Write failure • Checksum • To attack Disk crash • RAID
Disk crashes • Failure model • Mean time to failure • RAID Storage System • Providing fault-tolerance by redundancy • Improving the performance
RAID Storage System • Redundant Array of Inexpensive Disks • Combine multiple small, inexpensive disk drives into a group to yield performance exceeding that of one large, more expensive drive • Appear to the computer as a single virtual drive • Support fault-tolerance by redundantly storing information in various ways
RAID Types • Five types of array architectures, RAID 1 ~ 5 • Different disk fault-tolerance • Different trade-offs in features and performance • A non-redundant array of disk drives is often referred to as RAID 0 • Only RAID 0, 1, 3 and 5 are commonly used • RAID 2 and 4 do not offer any significant advantages over these other types • Certain combination is possible (10, 35 etc) • RAID 10 = RAID 1 + RAID 0
factors • Redundancy(cost, usage) • Read and write performance
RAID 0 - Striping • No redundancy • No fault tolerance • High I/O performance • Parallel I/O • RAID 0 implements a striped disk array, the data is broken down into blocks and each block is written to a separate disk drive • I/O performance is greatly improved by spreading the I/O load across many channels and drives
RAID 1 – Mirroring • Provide good fault tolerance • Works ok if one disk in a pair is down • One write = a physical write on each disk • One read = either read both or read the less busy one • Could double the read rate • Low usage rate, only ½ disks are used
RAID 3 - Parallel Array with Parity • One disk for parity, data disks are organized as stripes • N times disk i/o on Parity disks • Usage rate: (N-1)/N disks are used • N times I/O workloads on parity disk
example • Disk 1,2,3 are data disks and disk 4 is for parity checking • If • disk 1: 11110000 • disk 2: 10101010 • disk 3: 00111000 • Then • disk 4: 01100010 • if disk1 crashed, according to • disk 2: 10101010, • disk 3: 00111000, • disk 4: 01100010 • we can recover disk 1: 11110000
Read/Write in parity-based RAID • Read: parallel stripes read from multiple disks • Good performance • Write: 2 reads + 2 writes • Read old data stripe; read parity stripe (2 reads) • Pnew=(Sold xor Snew) xor Pold • XOR old data stripe with new data stripe. • XOR result into parity stripe. • Write new data stripe and new parity stripe (2 writes). • Bad for write-intensive apps
Example for Write on Pairty-based RAID • After writing new data, we need to ensuer the correctness of parity in redundant disk • Naïve approach: read another n-1 data disk, recalculate the parity, consuming extra n-1 I/O • Good strategy: 4 I/O • Example: • Change disk 2 to 11001100, parity is 01100010 • Sold xor Snew=10101010 xor 11001100=01100110 • Pnew=01100010 xor 01100110=00000100
RAID 5 – Parity Checking • Each stripe unit has an extra parity stripe • Parity stripes are distributed • N-1 disks are used, the same as RAID3
RAID 10 – Striped Mirroring • RAID 10 = Striping + mirroring • A striped array of RAID 1 arrays • High performance of RAID 0, and high tolerance of RAID 1 (at the cots of doubling disks) .. More information about RAID disks at http://www.acnc.com/04_01_05.html
Hardware vs. Software RAID • Software RAID (volume manager) • Software RAID: run on the server’s CPU • Directly dependent on server CPU performance and load • Occupies host system memory and CPU operation, degrading server performance • Hardware RAID (array controller) • Hardware RAID: run on the RAID controller’s CPU • Does not occupy any host system memory. Is not operating system dependent • Host CPU can execute applications while the array adapter's processor simultaneously executes array functions: true hardware multi-tasking
Which RAID Level to Use? • Data and Index Files • RAID 5 is best suited for read intensive apps or if the RAID controller cache is effective enough. • RAID 10 is best suited for write intensive apps. • Log File • RAID 1 is appropriate • Fault tolerance with high write throughput. Writes are synchronous and sequential. No benefits in striping. • Temporary Files • RAID 0 is appropriate. • No fault tolerance. High throughput.
RAID Levels - Data Settings: accounts( number, branchnum, balance); create clustered index c on accounts(number); • 100000 rows • Cold Buffer • Dual Xeon (550MHz,512Kb), 1Gb RAM, Internal RAID controller from Adaptec (80Mb), 4x18Gb drives (10000RPM), Windows 2000.
RAID Levels - Transactions No Concurrent Transactions: • Read Intensive: select avg(balance) from accounts; • Write Intensive, e.g. typical insert: insert into accounts values (690466,6840,2272.76); Writes are uniformly distributed.
SQL Server7 on Windows 2000 (SoftRAID means striping/parity at host) Read-Intensive: Using striping (RAID0, RAID 10, RAID5) increases throughput significantly. Write-Intensive: Without cache, RAID 5 suffers. With cache, it is ok. RAID Levels
Controller Pre-fetching No, Write-back Yes • Read-ahead: • Prefetching at the disk controller level. • No information on access pattern. • Better to let database management system do it. • Write-back vs. write through: • Write back: transfer terminated as soon as data is written to cache. • Batteries to guarantee write back in case of power failure • Fast cache flushing is a priority • Write through: transfer terminated as soon as data is written to disk.
Summary: What RAID Provides • Fault tolerance • It does not prevent disk drive failures • It enables real-time data recovery • High I/O performance • Mass data capacity • Configuration flexibility • Lower protected storage costs • Easy maintenance