storage refinement

32
1 Storage Refinement

Upload: lorie

Post on 12-Jan-2016

42 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Storage Refinement

1

Storage Refinement

Page 2: Storage Refinement

Outline

• Disk failures• To attack Intermittent failures• To attack Media Decay and Write

failure– Checksum

• To attack Disk crash– RAID

Page 3: Storage Refinement

3

Disk Failures

• Partial Total• Intermittent Permanent

Page 4: Storage Refinement

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

Page 5: Storage Refinement

5

Coping with Disk Failures

• Detection– e.g. Checksum

• Correction Redundancy

Page 6: Storage Refinement

Outline

• Disk failures• To attack Intermittent failures• To attack Media Decay and Write

failure– Checksum

• To attack Disk crash– RAID

Page 7: Storage Refinement

Intermittent failures

• Reading function returns (w,s)– W: data– S: status

• If s is bad, repeat reading enough times

Page 8: Storage Refinement

Outline

• Disk failures• To attack Intermittent failures• To attack Media Decay and

Write failure– Checksum– Stable storage

• To attack Disk crash– RAID

Page 9: Storage Refinement

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

Page 10: Storage Refinement

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

Logical Block Copy A Copy B

Page 11: Storage Refinement

CS 245 Notes 2 11

At what level do we cope?

• Single Disk– e.g., Error Correcting Codes

• Disk Array

Logical Physical

Page 12: Storage Refinement

Outline

• Disk failures• To attack Intermittent failures• To attack Media Decay and Write

failure– Checksum

• To attack Disk crash– RAID

Page 13: Storage Refinement

Disk crashes

• Failure model– Mean time to failure

• RAID Storage System– Providing fault-tolerance by

redundancy– Improving the performance

Page 14: Storage Refinement

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

Page 15: Storage Refinement

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

Page 16: Storage Refinement

factors

• Redundancy(cost, usage)• Read and write performance

16

Page 17: Storage Refinement

17

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

Page 18: Storage Refinement

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

Page 19: Storage Refinement

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

Page 20: Storage Refinement

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

Page 21: Storage Refinement

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

Page 22: Storage Refinement

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

Page 23: Storage Refinement

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

Page 24: Storage Refinement

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

Page 25: Storage Refinement

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

Page 26: Storage Refinement

26

Which RAID Level to Use?

• Data and Index Files– RAID 5 is best suited for read intensiveread intensive apps or

if the RAID controller cache is effective enough.– RAID 10 is best suited for write intensivewrite 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.

Page 27: Storage Refinement

Comparing RAID Levels

RAID 0 RAID 1 RAID 5 RAID 10Read High 2X High High

Write High 1X Medium High

Fault tolerance

No Yes Yes Yes

Disk utilization

High Low High Low

Key problems

Data lost when any disk fails

Use double the disk space

Lower throughput with disk failure

Very expensive, not scalable

Key advantages

High I/O performance

Very high I/O performance

A good overall balance

High reliability with good performance

Page 28: Storage Refinement

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.

Page 29: Storage Refinement

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.

Page 30: Storage Refinement

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

Write-Intensive

0

40

80

120

160

Soft-RAID5

RAID5 RAID0 RAID10 RAID1 SingleDisk

Th

rou

gh

pu

t (t

up

les/

sec)

Read-Intensive

0

20000

40000

60000

80000

Soft-RAID5

RAID5 RAID0 RAID10 RAID1 SingleDisk

Th

rou

gh

pu

t (t

up

les/

sec)

Page 31: Storage Refinement

31

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.

Page 32: Storage Refinement

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