Upload
sanapala-amit
View
225
Download
0
Embed Size (px)
Citation preview
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
1/96
Chapter 17
Disk Storage, BasicFile Structures, andHashing
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
2/96
Disk Storage Devices
Preferred secondary storage device for highstorage capacity and low cost.
Data stored as magnetized areas on magnetic
disk surfaces. A diskpackcontains several magnetic disks
connected to a rotating spindle.
Disks are divided into concentric circular tracks
on each disk surface. Track capacities vary typically from 4 to 50 Kbytes
or more
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
3/96
Typical Hard Drive Platter,Head,
ActuatorCylinder,
Track
Sector (physical),
Block (logical),
Gap
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
4/96
Top View
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
5/96
Typical Numbers
Diameter: 1 inch 15 inches
Cylinders: 100 2000
Surfaces: 1 (CDs)
(Tracks/cyl) 2 (floppies) 30
Sector Size: 512B 50K
Capacity: 360 KB (old floppy)
1 TB
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
6/96
Goal
How to lay out data on disk
How to move it to/from memory
I want
block X
block x
in memory
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
7/96
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
8/96
Seek Time: S
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
9/96
Average Random Seek Time: S
TypicalS: 10 ms 40 ms
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
10/96
Rotational Delay: R
R = 1/2
revolution
typical
R = 8.33 ms(3600 RPM)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
11/96
Transfer Rate: t
typical t: 10s 100s MB/second
transfer time: block size / t
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
12/96
Other Delays
CPU time to issue I/O
Contention for controller
Contention for bus, memory
Typical Value: 0
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
13/96
Buffering: Single Buffer
Single Buffer
(1) Read B1 Buffer
(2) Process Data in Buffer
(3) Read B2 Buffer
(4) Process Data in Buffer ...
Say:
P = time to process/block
R = time to read in 1 blockn = # blocks
Single buffer time = n(P+R)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
14/96
Buffering: Double Buffering
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
15/96
Buffering: Double Buffering
Say P R
P = Processing time/block
R = IO time/block
n = # blocks
Double buffering time = R + nP
Single buffering time = n(R+P)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
16/96
Disk Storage Devices (cont.)
A track is divided into smaller blocksor sectors
because it usually contains a large amount of information
The division of a track into sectorsis hard-coded on the
disk surface and cannot be changed.
A track is divided into blocks.
The block size B is fixed for each system.
Typical block sizes range from B=512 bytes to B=4096 bytes.
Whole blocks are transferred between disk and main
memory for processing.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
17/96
Disk Storage Devices (cont.)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
18/96
Disk Storage Devices (cont.)
A read-write headmoves to the track that contains theblock to be transferred. Disk rotation moves the block under the read-write head for
reading or writing.
A physical disk block (hardware) address consists of:
a cylinder number (imaginary collection of tracks of same radius from all recorded
surfaces)
the track number or surface number (within the cylinder)
and block number (within track).
Reading or writing a disk block is time consumingbecause of the seek time sand rotational delay (latency)rd.
Double buffering can be used to speed up the transfer ofcontiguous disk blocks.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
19/96
Disk Storage Devices (cont.)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
20/96
What are the data items we want to
store?
a salary
a name
a date
a picture
What we have available: Bytes
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
21/96
00000000
To represent
Integer(short): 2 bytes
e.g., 35 is
Characters
various coding schemes suggested, most
popular is ASCII (1 byte encoding) Example:
A: 1000001
a: 1100001
5: 0110101
Boolean
TRUE FALSE
00100011
0000 00001111 1111
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
22/96
To represent
Dates
Integer, # days since Jan 1, 1900
8 characters, YYYYMMDD
Time Integer, seconds since midnight
characters, HHMMSSFF
Stringof characters
Null terminated Length given
Fixed length
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
23/96
Records
Fixed length records
Variable length records
usually length given at beginning
Record- Collection of related data items (called
FIELDS) E.g.: Employee record:
name field,
salary field, date-of-hire field, ...
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
24/96
Record Types
FIXED vs VARIABLE FORMAT
A SCHEMA (not record) contains following
information
# fields type of each field
order in record
meaning of each field
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
25/96
Record Types: Example: fixed format and length
Employee record
(1) E#, 2 byte integer
(2) E.name, 10 char. Schema
(3) Dept, 2 byte code
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
26/96
Record Types : Variable format
Record itself contains format Self Describing
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
27/96
Record Types : Variable format
Variable format useful for
sparse records
repeating fields
evolving formats
EXAMPLE: var format record with repeating fields
Employee one or more children
Key is to allocate maximum number of repeating
fields (if not used null)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
28/96
Record header
data at beginning that describes record and may
contain:
record type
record length time stamp
null-value bitmap
Record header has a bitmap to store whether fieldis NULL
Only store non-NULL fields in record
other stuff ...
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
29/96
Separate Storage of Large Values
Store fields with large values separately
E.g., image or binary document
Records have pointers to large field content
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
30/96
Goal Data Items
Records
Blocks
Files
Memory
Key Point Fixedlength items
Variablelength items
usually length given at
beginning
Also Type of an item:Tells us how to interpret
(plus size if fixed)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
31/96
placing records into blocks
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
32/96
Options for storing records in blocks:
(1) separating records
(2) spanned vs. unspanned
(3) sequencing
(4) indirection
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
33/96
Records
Fixed and variable length records
Records contain fields which have values of aparticular type
E.g., amount, date, time, age Fields themselves may be fixed length or variable
length
Variable length fields can be mixed into one
record: Separator characters or length fields are needed
so that the record can be parsed.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
34/96
Separating records
Block
1. no need to separate - fixed size recs.
2. special marker
3. give record lengths (or offsets) within each record
in block header
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
35/96
Blocking
Blocking:
Refers to storing a number of records in one blockon the disk.
Blocking factor (bfr) refers to the number ofrecords per block.
There may be empty space in a block if anintegral number of records do not fit in one block.
Spanned Records: Refers to records that exceed the size of one or
more blocks and hence span a number of blocks.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
36/96
Files of Records
A fileis a sequenceof records, where each record is a
collection of data values (or data items).
A file descriptor(or file header) includes information that
describes the file, such as the field namesand their data
types, and the addresses of the file blocks on disk.
Records are stored on disk blocks.
The blocking factorbfrfor a file is the (average) number
of file records stored in a disk block.
A file can have fixed-lengthrecords or variable-length
records.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
37/96
Files of Records (cont.)
File records can be unspannedor spanned
Unspanned: no record can span two blocks
Spanned: a record can be stored in more than one block
The physical disk blocks that are allocated to hold the
records of a file can be contiguous, linked, or indexed. In a file of fixed-length records, all records have the same
format.
Usually, unspanned blocking is used with such files.
Files of variable-length records require additionalinformation to be stored in each record, such asseparatorcharactersand field types.
Usually spanned blocking is used with such files.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
38/96
Spanned vs. Unspanned
Unspanned: records must be within one block
Spanned
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
39/96
With spanned records:
Unspanned is much simpler, but may waste space
Spanned essential if
record size > block size
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
40/96
Operation on Files Typical file operations include:
OPEN: Readies the file for access, and associates a pointer that will refer
to a currentfile record at each point in time. FIND: Searches for the first file record that satisfies a certain condition, and
makes it the current file record.
FINDNEXT: Searches for the next file record (from the current record) thatsatisfies a certain condition, and makes it the current file record.
READ: Reads the current file record into a program variable.
INSERT: Inserts a new record into the file & makes it the current filerecord.
DELETE: Removes the current file record from the file, usually by markingthe record to indicate that it is no longer valid.
MODIFY: Changes the values of some fields of the current file record.
CLOSE: Terminates access to the file.
REORGANIZE: Reorganizes the file records.
For example, the records marked deleted are physically removed fromthe file or a new organization of the file records is created.
READ_ORDERED: Read the file blocks in order of a specific field of thefile.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
41/96
Unordered Files
Also called a heapor a pilefile.
New records are inserted at the end of the file.
A linear searchthrough the file records is
necessary to search for a record. This requires reading and searching half the file
blocks on the average, and is hence quite
expensive.
Record insertion is quite efficient.
Reading the records in order of a particular field
requires sorting the file records.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
42/96
Ordered Files: Sequencing
Also called a sequentialfile.
File records are kept sorted by the values of an orderingfield.
Insertion is expensive: records must be inserted in the correct order.
It is common to keep a separate unordered overflow(ortransaction) file for new records to improve insertion efficiency;
this is periodically merged with the main ordered file. A binary searchcan be used to search for a record on its ordering
fieldvalue.
This requires reading and searching log2of the file blocks on theaverage, an improvement over linear search.
Reading the records in order of the ordering field is quite efficient.
Ordered Files (cont )
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
43/96
Ordered Files (cont.)
Sequencing Options
1. Next record physically
contiguous
2. Linked
3. Overflow area
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
44/96
Indirection
How does one refer to records?
Many options:
Physical Indirect
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
45/96
Indirection: identifying a record
1. Purely Physical
E.g., Record Address or ID =
Device ID
Cylinder #
Track #
Block # Offset in block
Block ID
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
46/96
Indirection: identifying a record
2. Fully Indirect
Record ID is arbitrary bit string
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
47/96
Block header
data at beginning that describes block
May contain:
File ID (or RELATION or DB ID)
This block ID
Record directory
Pointer to free space
Type of block (e.g. contains recs type 4; isoverflow, )
Pointer to other blocks like it
Timestamp ...
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
48/96
Example: Indirection in block
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
49/96
Tuple Identifier (TID)
TID is
Page identifier
Slot number
Slot stores either record or pointer (TID)
TID of a record is fixed for all time
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
50/96
TID Operations
Insertion
Set TID to record location (page, slot)
Moving record
e.g., update variable-size or reorganization Case 1: TID points to record
Replace record with pointer (new TID)
Case 2: TID points to pointer (TID)
Replace pointer with new pointer
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
51/96
TID: Block 1, Slot 2
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
52/96
TID: Block 1, Slot 2 unchanged
Move record to
Block 2 slot 3 -> TID does not change!
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
53/96
TID: Block 1, Slot 2 unchanged
Move record to
Block 2 slot 2-> TID does not change!
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
54/96
TID Properties
TID of record never changes
Can be used safely as pointer to record
(e.g., in index)
At most one level of indirection Relatively efficient
Changes to physical addresschanging max 2
pages
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
55/96
Average Access Times
The following table shows the average access
time to access a specific record for a given type
of file
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
56/96
Options for storing records in blocks
We covered
(1) separating records
(2) spanned vs. unspanned
(3) sequencing(4) indirection
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
57/96
Now what?
Insertion of new record
Deletion of existing records
Buffer management
Deletion
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
58/96
Block
Options:
Immediately reclaim space
Mark deleted
May need chain of deleted records (for re-use)
Need a way to mark:
special characters
delete field
in map
Tradeoffs
How expensive?
How much space wasted
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
59/96
Concern with deletions
Dangling pointers
Options
Who cares?
Tombstones E.g., Leave MARK in map or old location
Physical IDs
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
60/96
Concern with deletions
Dangling pointers
Option#1: Who cares?
Option#2: Tombstones
E.g., Leave MARK in map or old location (1) Physical IDs
(2) Logical IDs
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
61/96
Insert
Easy case: records not in sequence
Insert new record at end of file or in deleted slot
If records are variable size, not as easy...
Hard case: records in sequence
If free space close by, not too bad...
Or use overflow idea...
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
62/96
Interesting problems:
How much free space to
leave in each block,
track, cylinder?
How often do Ireorganize file +
overflow?
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
63/96
BUFFER MANAGEMENT
Buffer manager intelligently shuffles data from main memory to disk:
It is transparent to higher levels of DBMS operation
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
64/96
Buffer Management in a DBMS
Data must be in RAM for DBMS to operate on it!
Table of pairs ismaintained
DB
MAIN MEMORY
DISK
disk page
free frame
Page Requests from Higher Levels
BUFFER POOL
choice of frame dictated
by replacement policy
READWRITE
INPUT
OUTUPT
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
65/96
When a page is requested
Apageis the unit of memory we request
If Page in the pool
Great no need to go to disk!
If not? Choose a frame to replace.
If there is a free frame, use it!
Terminology: We pin a page (means its in use)
If not? We need to choose a page to remove! How DBMS makes choice is a replacement
policy
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
66/96
Buffer Manager
Manages blocks (pages) cached from disk in
main memory
Usually -> fixed size buffer (M pages)
DB requests page from Buffer Manager Case 1: page is in memory -> return address
Case 2: page is on disk -> load into memory,
return address
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
67/96
Buffer Manager: Goal
Reduce the amount of I/O
Maximize the hit rate
Ratio of number of page accesses that are fulfilled
without reading from disk -> Need strategy to decide when to load from disk
and what to remove from the buffer
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
68/96
Once we choose a page to remove
A page is dirty, if its contents have been changed
after writing
Buffer Manager keeps a dirty bit
Say we choose to evict P
If P is dirty, we write it to disk
If P is not dirty, then what?
Buffer Manager Organization
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
69/96
Buffer Manager Organization Bookkeeping
Need to map (hash table) page-ids to locations in buffer (page
frames) Per page store fix count, dirty bit,
Manage free space
Replacement strategy
If page is requested but buffer is full Which page to emit remove from buffer???
FIFO
LRU
Clock
LRU-K GCLOCK
Clock-Pro
ARC
LFU
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
70/96
FIFO
First In, First Out
Replace page that has been in the buffer for the
longest time
Implementation: E.g., pointer to oldest page(circular buffer)
Simple, but not prioritizing frequently accessedpages
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
71/96
LRU
Least Recently Used
Replace page that has not been accessed for the
longest time
Implementation:
List, ordered by LRU
Access a page, move it to list tail
Widely applied and reasonable performance
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
72/96
Least Recently Used (LRU)
Order pages by the time of last accessed Always replace the least recently accessed
P5, P2, P8, P4, P1, P9, P6, P3, P7
Access P6
P6, P5, P2, P8, P4, P1, P9, P3, P7
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
73/96
Clock
Frames are organized clock-wise
Pointer S to current frame
Each frame has a reference bit
Page is loaded or accessed -> bit = 1
Find page to replace (advance pointer)
Return first frame with bit = 0
If current is referenced, then unset ref bit andmove on
On the way set all bits to 0
Whenever a bit is referenced, set the bit
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
74/96
Simplified Buffer Manager Flowchart
Request a Page
Find a page P that is
unpinned according to policy.
Return Frame
handle to caller
Flush P to
Disk
Dirty
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
75/96
ROW VS COLUMN STORE
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
76/96
Row vs. Column Store
So far we assumed that fields of a record arestored contiguously (row store)...
Another option is to store all values of a field
together (column store)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
77/96
Row Store
Example: Order consists of
id, cust, prod, store, price, date, qty
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
78/96
Column Store
Example: Order consists of
id, cust, prod, store, price, date, qty
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
79/96
Row vs Column Store
Advantages of Column Store
more compact storage (fields need not start at
byte boundaries)
Efficient compression, efficient reads on data mining operations
Advantages of Row Store
writes (multiple fields of one record) more efficient
efficient reads for record access (OLTP)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
80/96
HASHING
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
81/96
Hashed Files
Hashing for disk files is called External Hashing The file blocks are divided into M equal-sized buckets, numbered
bucket0, bucket1, ..., bucketM-1.
Typically, a bucket corresponds to one (or a fixed number of) diskblock.
One of the file fields is designated to be the hash keyof the file. The record with hash key value K is stored in bucket i, where i=h(K),
and h is the hashing function.
Search is very efficient on the hash key.
Collisions occur when a new record hashes to a bucket that is already
full. An overflow file is kept for storing such records.
Overflow records that hash to each bucket can be linked together.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
82/96
Hashed Files (cont.)
There are numerous methods for collision resolution, including thefollowing:
Open addressing: Proceeding from the occupied positionspecified by the hash address, the program checks thesubsequent positions in order until an unused (empty) position isfound.
Chaining: For this method, various overflow locations are kept,usually by extending the array with a number of overflowpositions. In addition, a pointer field is added to each recordlocation. A collision is resolved by placing the new record in anunused overflow location and setting the pointer of the occupiedhash address location to the address of that overflow location.
Multiple hashing: The program applies a second hash function ifthe first results in a collision. If another collision results, theprogram uses open addressing or applies a third hash functionand then uses open addressing if necessary.
Hashed Files (cont )
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
83/96
Hashed Files (cont.)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
84/96
Hashed Files (cont.)
To reduce overflow records, a hash file is typicallykept 70-80% full.
The hash function h should distribute the recordsuniformly among the buckets
Otherwise, search time will be increased becausemany overflow records will exist.
Main disadvantages of static external hashing:
Fixed number of buckets M is a problem if thenumber of records in the file grows or shrinks.
Ordered access on the hash key is quite inefficient(requires sorting the records).
Hashed Files - Overflow Handling
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
85/96
Dynamic And Extendible Hashed
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
86/96
Files
Dynamic and Extendible Hashing Techniques Hashing techniques are adapted to allow the dynamic
growth and shrinking of the number of file records.
These techniques include the following:dynamic hashing,
extendible hashing, andlinear hashing. Both dynamic and extendible hashing use the binary
representationof the hash value h(K) in order to access
a directory.
In dynamic hashing the directory is a binary tree. In extendible hashing the directory is an array of size 2d
where d is called the global depth.
Dynamic And Extendible Hashing
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
87/96
(cont.)
The directories can be stored on disk, and they expand orshrink dynamically. Directory entries point to the disk blocks that contain the
stored records.
An insertion in a disk block that is full causes the block to
split into two blocks and the records are redistributedamong the two blocks. The directory is updated appropriately.
Dynamic and extendible hashing do not require anoverflow area.
Linear hashing does require an overflow area but doesnot use a directory. Blocks are split in linear orderas the file expands.
Extendible
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
88/96
Hashing
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
89/96
RAID
Parallelizing Disk Access using RAID
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
90/96
Technology.
Secondary storage technology must take steps tokeep up in performance and reliability withprocessor technology.
A major advance in secondary storage
technology is represented by the development ofRAID, which originally stood for RedundantArrays of Inexpensive Disks.
The main goal of RAID is to even out the widely
different rates of performance improvement ofdisks against those in memory andmicroprocessors.
RAID Technology (cont )
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
91/96
RAID Technology (cont.)
A natural solution is a large array of small independent
disks acting as a single higher-performance logical disk. A concept called data stripingis used, which utilizes
parallelism to improve disk performance.
Data striping distributes data transparently over multipledisks to make them appear as a single large, fast disk.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
92/96
RAID Technology (cont.)
Different raid organizations were defined based on differentcombinations of the two factors of granularity of data interleaving(striping) and pattern used to compute redundant information.
Raid level 0 has no redundant data and hence has the best writeperformance at the risk of data loss
Raid level 1 uses mirrored disks.
Raid level 2 uses memory-style redundancy by using Hammingcodes, which contain parity bits for distinct overlapping subsets ofcomponents. Level 2 includes both error detection and correction.
Raid level 3 uses a single parity disk relying on the disk controllerto figure out which disk has failed.
Raid Levels 4 and 5 use block-level data striping, with level 5
distributing data and parity information across all disks. Raid level 6 applies the so-called P + Q redundancy scheme
using Reed-Soloman codes to protect against up to two diskfailures by using just two redundant disks.
Use of RAID Technology (cont.)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
93/96
gy ( )
Different raid organizations are being used under different situations
Raid level 1 (mirrored disks) is the easiest for rebuild of a disk from
other disks It is used for critical applications like logs
Raid level 2 uses memory-style redundancy by using Hammingcodes, which contain parity bits for distinct overlapping subsets ofcomponents. Level 2 includes both error detection and correction.
Raid level 3 (single parity disks relying on the disk controller to figureout which disk has failed) and level 5 (block-level data striping) arepreferred for Large volume storage, with level 3 giving higher transferrates.
Most popular uses of the RAID technology currently are:
Level 0 (with striping), Level 1 (with mirroring) and Level 5 with an
extra drive for parity. Design Decisions for RAID include:
Level of RAID, number of disks, choice of parity schemes, andgrouping of disks for block-level striping.
Use of RAID Technology (cont.)
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
94/96
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
95/96
Storage Area Networks
The demand for higher storage has risen considerably inrecent times.
Organizations have a need to move from a static fixeddata center oriented operation to a more flexible anddynamic infrastructure for information processing.
Thus they are moving to a concept of Storage AreaNetworks (SANs).
In a SAN, online storage peripherals are configured asnodes on a high-speed network and can be attached and
detached from servers in a very flexible manner. This allows storage systems to be placed at longer
distances from the servers and provide differentperformance and connectivity options.
8/10/2019 Elmasri 6e Ch17 Week2 HW DiskStorage
96/96
Storage Area Networks (cont.)
Advantages of SANs are: Flexible many-to-many connectivity among servers and
storage devices using fiber channel hubs and switches.
Up to 10km separation between a server and a storage
system using appropriate fiber optic cables. Better isolation capabilities allowing non-disruptive addition
of new peripherals and servers.
SANs face the problem of combining storage options from
multiple vendors and dealing with evolving standards ofstorage management software and hardware.