§ Can differentiate storage into:
• volatile storage: loses contents when power is switched off
• non-volatile storage:
§ Contents persist even when power is switched off.
§ Includes secondary and tertiary storage, as well as batter-backed
up main-memory.
§ Factors affecting choice of storage media include
• Speed with which data can be accessed
• Cost per unit of data
• Reliability
§ primary storage: Fastest media but volatile (cache, main memory).
§ secondary storage: next level in hierarchy, non-volatile, moderately fast
access time
• Also called on-line storage
• E.g., flash memory, magnetic disks
§ tertiary storage: lowest level in hierarchy, non-volatile, slow access time
• also called off-line storage and used for archival storage
• e.g., magnetic tape, optical storage
• Magnetic tape
§ Sequential access, 1 to 12 TB capacity
§ A few drives with many tapes
§ Juke boxes with petabytes (1000’s of TB) of storage
§ Disk interface standards families
• SATA (Serial ATA)
§ SATA 3 supports data transfer speeds of up to 6 gigabits/sec
• SAS (Serial Attached SCSI)
§ SAS Version 3 supports 12 gigabits/sec
• NVMe (Non-Volatile Memory Express) interface
§ Works with PCIe connectors to support lower latency and higher
transfer rates
§ Supports data transfer rates of up to 24 gigabits/sec
§ Disks usually connected directly to computer system
§ In Storage Area Networks (SAN), a large number of disks are connected
by a high-speed network to a number of servers
§ In Network Attached Storage (NAS) networked storage provides a file
system interface using networked file system protocol, instead of
providing a disk system interface
§ Read-write head
§ Surface of platter divided into circular tracks
• Over 50K-100K tracks per platter on typical hard disks
§ Each track is divided into sectors.
• A sector is the smallest unit of data that can be read or written.
• Sector size typically 512 bytes
• Typical sectors per track: 500 to 1000 (on inner tracks) to 1000 to
2000 (on outer tracks)
§ To read/write a sector
• disk arm swings to position head on right track
• platter spins continually; data is read/written as sector passes under
head
Assistant
§ Head-disk assemblies
• multiple disk platters on a single spindle (1 to 5 usually)
• one head per platter, mounted on a common arm.
§ Cylinder i consists of i
§ Disk controller – interfaces between the computer system and the disk
drive hardware.
• accepts high-level commands to read or write a sector
• initiates actions such as moving the disk arm to the right track and
actually reading or writing the data
• Computes and attaches checksums to each sector to verify that
data is read back correctly
§ If data is corrupted, with very high probability stored checksum
won’t match recomputed checksum
• Ensures successful writing by reading back sector after writing it
• Performs remapping of bad sectors
§ Access time – the time it takes from when a read or write request is
issued to when data transfer begins. Consists of:
• Seek time – time it takes to reposition the arm over the correct track.
§ Average seek time is 1/2 the worst case seek time.
• Would be 1/3 if all tracks had the same number of sectors, and
we ignore the time to start and stop arm movement
§ 4 to 10 milliseconds on typical disks
• Rotational latency – time it takes for the sector to be accessed to
appear under the head.
§ 4 to 11 milliseconds on typical disks (5400 to 15000 r.p.m.)
§ Average latency is 1/2 of the above latency.
• Overall latency is 5 to 20 msec depending on disk model
§ Data-transfer rate – the rate at which data can be retrieved from or stored
to the disk.
• 25 to 200 MB per second max rate, lower for inner tracks
§ Disk block is a logical unit for storage allocation and retrieval
• 4 to 16 kilobytes typically
§ Smaller blocks: more transfers from disk
§ Larger blocks: more space wasted due to partially filled blocks
§ Sequential access pattern
• Successive requests are for successive disk blocks
• Disk seek required only for first block
§ Random access pattern
• Successive requests are for blocks that can be anywhere on disk
• Each access requires a seek
• Transfer rates are low since a lot of time is wasted in seeks
§ I/O operations per second (IOPS)
• Number of random block reads that a disk can support per second
• 50 to 200 IOPS on current generation magnetic disks
§ Mean time to failure (MTTF) – the average time the disk is expected to
run continuously without any failure.
• Typically 3 to 5 years
• Probability of failure of new disks is quite low, corresponding to a
“theoretical MTTF” of 500,000 to 1,200,000 hours for a new disk
§ E.g., an MTTF of 1,200,000 hours for a new disk means that given
1000 relatively new disks, on an average one will fail every 1200
hours
§ RAID: Redundant Arrays of Independent Disks
• disk organization techniques that manage a large numbers of disks,
providing a view of a single disk of
§ high capacity and high speed by using multiple disks in parallel,
§ high reliability by storing data redundantly, so that data can be
recovered even if a disk fails
§ The chance that some disk out of a set of N disks will fail is much higher
than the chance that a specific single disk will fail.
• E.g., a system with 100 disks, each with MTTF of 100,000 hours
(approx. 11 years), will have a system MTTF of 1000 hours (approx.
41 days)
• Techniques for using redundancy to avoid data loss are critical with
large numbers of disks
§ Mean time to data loss depends on mean time to failure,
and mean time to repair
• E.g., MTTF of 100,000 hours, mean time to repair of 10 hours gives
mean time to data loss of 500*106 hours (or 57,000 years) for a
mirrored pair of disks (ignoring dependent failure modes)
Load balance multiple small accesses to increase throughput
Parallelize large accesses to reduce response time.
§ Improve transfer rate by striping data across multiple disks.
§ Bit-level striping – split the bits of each byte across multiple disks
• In an array of eight disks, write bit i of each byte to disk i.
• Each access can read data at eight times the rate of a single disk.
• But seek/access time worse than for a single disk
§ Bit level striping is not used much any more
§ Block-level striping – with n disks, block i of a file goes to disk (i mod n)
1
• Requests for different blocks can run in parallel if the blocks reside on
different disks
• A request for a long sequence of blocks can utilize all disks in parallel
§ Schemes to provide redundancy at lower cost by using disk striping
combined with parity bits
• Different RAID organizations, or RAID levels, have differing cost,
performance and reliability characteristics
§ RAID Level 0: Block striping; non-redundant.
• Used in high-performance applications where data loss is not critical.
§ RAID Level 1: Mirrored disks with block striping
• Offers best write performance.
• Popular for applications such as storing log files in a database system.
§ Parity blocks: Parity block j stores XOR of bits from block j of each disk
• When writing data to a block j, parity block j must also be computed
and written to disk
§ Can be done by using old parity block, old value of current block
and new value of current block (2 block reads + 2 block writes)
§ Or by recomputing the parity value using the new values of blocks
corresponding to the parity block
• More efficient for writing large amounts of data sequentially
• To recover data for a block, compute XOR of bits from all other
blocks in the set including the parity block
§ RAID Level 5: Block-Interleaved Distributed Parity; partitions data and
parity among all N + 1 disks, rather than storing data in N disks and parity
in 1 disk.
• E.g., with 5 disks, parity block for nth set of blocks is stored on disk
(n mod 5) + 1, with the data blocks stored on the other 4 disks.
§ RAID Level 5 (Cont.)
• Block writes occur in parallel if the blocks and their parity blocks are
on different disks.
§ RAID Level 6: P+Q Redundancy scheme; similar to Level 5, but stores
two error correction blocks (P, Q) instead of single parity block to guard
against multiple disk failures.
• Better reliability than Level 5 at a higher cost
§ Becoming more important as storage sizes increase
§ Other levels (not used in practice):
• RAID Level 2: Memory-Style Error-Correcting-Codes (ECC) with bit
striping.
• RAID Level 3: Bit-Interleaved Parity
• RAID Level 4: Block-Interleaved Parity; uses block-level striping,
and keeps a parity block on a separate parity disk for corresponding
blocks from N other disks.
§ RAID 5 is better than RAID 4, since with RAID 4 with random
writes, parity disk gets much higher write load than other disks
and becomes a bottleneck
§ Factors in choosing RAID level
• Monetary cost
• Performance: Number of I/O
operations per second, and
bandwidth during normal operation
• Performance during failure
• Performance during rebuild of failed
disk
§ Including time taken to rebuild
failed disk
§ RAID 0 is used only when data safety is
not important
• E.g., data can be recovered quickly
from other sources
§ Level 1 provides much better write performance than level 5
• Level 5 requires at least 2 block reads and 2 block writes to write a
single block, whereas Level 1 only requires 2 block writes
§ Level 1 had higher storage cost than level 5
§ Level 5 is preferred for applications where writes are sequential and large
(many blocks), and need large amounts of data storage
§ RAID 1 is preferred for applications with many random/small updates
§ Level 6 gives better data protection than RAID 5 since it can tolerate two
disk (or disk block) failures
• Increasing in importance since latent block failures on one disk,
coupled with a failure of another disk can result in data loss with RAID
1 and RAID 5.
§ Software RAID: RAID implementations done entirely in software, with
no special hardware support
§ Hardware RAID: RAID implementations with special hardware
• Use non-volatile RAM to record writes that are being executed
• Beware: power failure during write can result in corrupted disk
§ E.g., failure after writing one block but before writing the second
in a mirrored system
§ Such corrupted data must be detected when power is restored
• Recovery from corruption is similar to recovery from failed
disk
• NV-RAM helps to efficiently detected potentially corrupted
blocks
§ Otherwise all blocks of disk must be read and compared
with mirror/parity block
§ Latent failures: data successfully written earlier gets damaged
• can result in data loss even if only one disk fails
§ Data scrubbing:
• continually scan for latent failures, and recover from copy/parity
§ Hot swapping: replacement of disk while system is running, without power
down
• Supported by some hardware RAID systems,
• reduces time to recovery, and improves availability greatly
§ Many systems maintain spare disks which are kept online, and used as
replacements for failed disks immediately on detection of failure
• Reduces time to recovery greatly
§ Many hardware RAID systems ensure that a single point of failure will not
stop the functioning of the system by using
• Redundant power supplies with battery backup
• Multiple controllers and multiple interconnections to guard against
controller/interconnection failures
§ Buffering: in-memory buffer to cache disk blocks
§ Read-ahead: Read extra blocks from a track in anticipation that they will
be requested soon
§ Disk-arm-scheduling algorithms re-order block requests so that disk arm
movement is minimized
• elevator algorithm
§ Buffering: in-memory buffer to cache disk blocks
§ Read-ahead: Read extra blocks from a track in anticipation that they will
be requested soon
§ Disk-arm-scheduling algorithms re-order block requests so that disk arm
movement is minimized
• elevator algorithm
§ Hold large volumes of data and provide high transfer rates
• Few GB for DAT (Digital Audio Tape) format, 10-40 GB with DLT
(Digital Linear Tape) format, 100 GB+ with Ultrium format, and 330 GB
with Ampex helical scan format
• Transfer rates from few to 10s of MB/s
§ Tapes are cheap, but cost of drives is very high
§ Very slow access time in comparison to magnetic and optical disks
• limited to sequential access.
• Some formats (Accelis) provide faster seek (10s of seconds) at cost of
lower capacity
§ Used mainly for backup, for storage of infrequently used information, and
as an off-line medium for transferring information from one system to
another.
§ Tape jukeboxes used for very large capacity storage
• Multiple petabyes (1015 bytes)
Sure! Let's break down the concepts from Chapter 12: Physical Storage Systems of Database System Concepts - 7th Edition by Silberschatz, Korth, and Sudarshan into simpler and detailed explanations. This chapter covers how data is physically stored in computer systems, focusing on different types of storage media, their organization, performance, reliability, and methods to optimize their usage.
1. Classification of Physical Storage Media
Types of Storage:
Volatile Storage:
Definition: Loses all its data when the power is turned off.
Use Case: Temporarily holds data that the CPU needs quick access to while performing tasks.
Non-Volatile Storage:
Definition: Retains data even when the power is switched off.
Includes:
Secondary Storage: Permanent storage for data (e.g., hard drives, SSDs).
Tertiary Storage: Used for long-term archival storage (e.g., magnetic tapes).
Battery-Backed Main Memory: Acts like volatile storage but with a battery to preserve data when power is lost.
Use Case: Stores important data permanently or for future use.
Factors Influencing Storage Choice:
Speed: How quickly data can be accessed or written.
Cost: How much it costs to store each unit of data.
Reliability: How dependable the storage medium is (likelihood of data loss or corruption).
2. Storage Hierarchy
Storage systems are organized in layers based on speed, cost, and capacity. Here's a simplified hierarchy:
Primary Storage:
Characteristics: Fastest but volatile.
Components: CPU cache, main memory (RAM).
Use Case: Holds data currently being used by the CPU for processing.
Secondary Storage:
Characteristics: Slower than primary storage but non-volatile and offers more capacity.
Types:
On-line Storage: Always connected to the computer system (e.g., SSDs, HDDs).
Examples: Flash memory (like USB drives), magnetic disks (hard drives).
Use Case: Stores data that needs to be accessed regularly but doesn't require the speed of primary storage.
Tertiary Storage:
Characteristics: Lowest in the hierarchy, non-volatile, and has the largest capacity but slowest access.
Types:
Off-line Storage: Not always connected but can be accessed when needed (e.g., tapes).
Examples: Magnetic tape, optical discs (CDs, DVDs).
Use Case: Ideal for backups, archival data, and storing large amounts of data that aren't accessed frequently.
Magnetic Tape Details:
Access Method: Sequential (you have to wind through the tape to get to the data).
Capacity: Ranges from 1 TB to petabytes.
Uses: Long-term storage where speed isn't critical.
3. Storage Interfaces
Disk Interface Standards:
SATA (Serial ATA):
Speed: Up to 6 gigabits per second.
Use Case: Commonly used for connecting hard drives and SSDs in personal computers.
SAS (Serial Attached SCSI):
Speed: Up to 12 gigabits per second.
Use Case: Used in enterprise environments for servers and high-performance storage systems.
NVMe (Non-Volatile Memory Express):
Speed: Up to 24 gigabits per second.
Features: Connects directly to the PCIe (Peripheral Component Interconnect Express) bus, reducing latency and increasing data transfer rates.
Use Case: High-speed SSDs for gaming, data centers, and applications requiring fast data access.
Connection Types:
Direct Connection: Disks are directly connected to the computer system.
Storage Area Networks (SAN):
Definition: A high-speed network that connects multiple disks to multiple servers.
Use Case: Provides centralized storage for large-scale data management.
Network Attached Storage (NAS):
Definition: Storage devices connected to a network, providing file-based data access via network protocols.
Use Case: Suitable for file sharing and collaborative environments.
4. Magnetic Hard Disk Mechanism
Components of a Magnetic Disk Drive:
Platters:
Description: Circular disks coated with magnetic material where data is stored.
Tracks: Concentric circles on the platter surface; there can be tens of thousands of tracks per platter.
Sectors: Divisions of each track; the smallest unit of data that can be read or written (typically 512 bytes).
Read-Write Heads:
Function: Move over the platters to read data from or write data to the sectors.
Disk Arm:
Function: Moves the read-write head to the correct track.
Spindle:
Function: Holds multiple platters; they spin together at high speeds.
How Data is Accessed:
Positioning:
The disk arm moves the read-write head to the desired track.
Reading/Writing:
The platter spins, and data is read from or written to the correct sector as it passes under the head.
Head-Disk Assemblies:
Definition: A set of platters and their corresponding read-write heads mounted on a common spindle.
Cylinder: A set of tracks aligned vertically across all platters.
5. Performance Measures of Disks
Key Performance Metrics:
Access Time:
Definition: Time from issuing a read/write request to the start of data transfer.
Components:
Seek Time: Time to move the read-write head to the correct track (typically 4-10 milliseconds).
Rotational Latency: Time waiting for the desired sector to rotate under the head (typically 4-11 milliseconds based on disk speed).
Overall: Access time ranges from 5 to 20 milliseconds.
Data-Transfer Rate:
Definition: Speed at which data can be read from or written to the disk.
Typical Rates: 25 to 200 megabytes per second (MB/s).
I/O Operations Per Second (IOPS):
Definition: Number of input/output operations a disk can perform each second.
Typical Range: 50 to 200 IOPS for current magnetic disks.
Mean Time to Failure (MTTF):
Definition: Average time a disk operates before failing.
Typical MTTF: 3 to 5 years.
Example: For 1,000 disks each with an MTTF of 1,200,000 hours, on average, one disk may fail every 1,200 hours.
Block Size Considerations:
Disk Block: The smallest unit of data storage on a disk (typically 4 to 16 kilobytes).
Smaller Blocks: More I/O operations needed but less wasted space.
Larger Blocks: Fewer I/O operations but can waste space if not fully utilized.
Access Patterns:
Sequential Access:
Definition: Accessing consecutive disk blocks one after another.
Performance: Faster as the read-write head doesn’t need to move much after the first block.
Random Access:
Definition: Accessing disk blocks scattered across the disk.
Performance: Slower due to frequent head movements and higher latency.
6. RAID (Redundant Arrays of Independent Disks)
What is RAID?
Definition: A technology that combines multiple physical disks into a single logical unit to improve performance, capacity, and reliability.
Benefits:
High Capacity and Speed: Using multiple disks in parallel increases data storage and access speeds.
High Reliability: Data is duplicated or spread with redundancy so that if one disk fails, data isn't lost.
Why Use RAID?
Increased Failure Risk: The more disks you have, the higher the chance that one will fail.
Example: 100 disks each with an MTTF of 100,000 hours mean the system's overall MTTF is much lower (e.g., one failure every 1,000 hours).
Solution: RAID uses techniques like mirroring and parity to protect against data loss from disk failures.
RAID Levels
Different RAID levels offer different balances of performance, cost, and reliability. Here's a summary of the most common RAID levels:
RAID Level 0: Striping
Description: Data is split across multiple disks (striped) without any redundancy.
Pros: High performance and full disk capacity.
Cons: No fault tolerance; if one disk fails, all data is lost.
Use Case: Applications where speed is critical, and data loss is not a major concern (e.g., gaming).
RAID Level 1: Mirroring
Description: Data is duplicated exactly on two or more disks.
Pros: High reliability; data is safe if one disk fails.
Cons: Higher cost due to duplication; only half the total disk capacity is usable.
Use Case: Applications requiring high data reliability, such as database log files.
RAID Level 5: Distributed Parity
Description: Data and parity (error-checking information) are spread across all disks.
Pros: Good balance of performance, storage efficiency, and reliability; can tolerate one disk failure.
Cons: Slower write performance due to parity calculations; more complex.
Use Case: General-purpose storage where a balance of speed and reliability is needed.
RAID Level 6: Dual Distributed Parity
Description: Similar to RAID 5 but with two parity blocks, allowing for two disk failures.
Pros: Higher fault tolerance than RAID 5.
Cons: Even slower write performance and higher cost.
Use Case: Environments where data availability is critical, and large disk arrays are used.
Other RAID Levels:
RAID Level 2, 3, 4: Rarely used in practice.
RAID Level 4: Uses block-level striping with a dedicated parity disk, which can become a bottleneck during writes.
Choosing the Right RAID Level
Factors to Consider:
Cost: More redundancy typically means higher costs (more disks needed).
Performance Needs: Depending on read/write patterns, some RAID levels offer better performance.
Reliability Requirements: Higher RAID levels (like RAID 6) offer better protection against multiple disk failures.
Rebuild Time: When a disk fails, RAID needs to rebuild the data on a new disk, which can impact performance and reliability.
Recommendations:
RAID 0: Only when performance is critical and data loss is acceptable.
RAID 1: When you need fast write performance and high data reliability.
RAID 5: For balanced performance and storage efficiency in environments with sequential writes.
RAID 6: When additional fault tolerance is required, especially with large numbers of disks.
RAID Implementations: Hardware vs. Software
Software RAID:
Description: Managed by the operating system without special hardware.
Pros: Cheaper as it uses existing system resources.
Cons: Can consume CPU resources and might be slower compared to hardware RAID.
Hardware RAID:
Description: Uses dedicated hardware (RAID controllers) to manage the RAID array.
Pros: Better performance, especially during RAID operations like rebuilding. Often includes features like non-volatile RAM to protect data during power failures.
Cons: More expensive due to specialized hardware.
Additional Hardware Considerations
Latent Failures:
Definition: Data previously written correctly becomes corrupted over time.
Solution:
Data Scrubbing: Regularly scanning and correcting any corrupted data using redundancy.
Hot Swapping: Replacing faulty disks without shutting down the system, improving uptime.
Includes: Backup power supplies, multiple controllers.
Purpose: Prevent single points of failure from bringing down the entire storage system.
7. Optimization of Disk-Block Access
To make disk access faster and more efficient, several optimization techniques are employed:
Buffering (Caching):
Definition: Using a portion of memory (RAM) to store frequently accessed disk blocks.
Benefit: Reduces the number of physical disk reads/writes, speeding up data access.
Read-Ahead:
Definition: Predicting which blocks will be needed next and loading them into the buffer in advance.
Benefit: Improves performance for sequential data accesses by minimizing wait times.
Disk-Arm Scheduling Algorithms:
Purpose: Organize the order of disk access requests to minimize the movement of the disk arm, reducing seek time.
Example: Elevator Algorithm (also known as SCAN):
The disk arm moves in one direction, servicing requests until it reaches the end, then reverses direction.
This approach reduces the total movement of the disk arm, improving efficiency.
Visualization:
Imagine the read-write head as an elevator in a building, moving up and down to service floor requests. Just like the elevator algorithm optimizes floor servicing to minimize waiting times, disk-arm scheduling optimizes head movements to speed up data access.
8. Magnetic Tapes
Overview:
Type of Storage: Tertiary storage often used for backups and long-term archival.
Capacity: Varies by format:
DAT (Digital Audio Tape): Few gigabytes.
DLT (Digital Linear Tape): 10-40 GB.
Ultrium: 100+ GB.
Ampex Helical Scan: Up to 330 GB.
Transfer Rates: From a few megabytes per second (MB/s) to tens of MB/s.
Characteristics:
Cost: Tapes themselves are inexpensive, but the tape drives (hardware) are costly.
Access Time:
Sequential Access: Only allows reading/writing data in order, which is much slower compared to random access in disks.
Special Formats (e.g., Accelis): Offer faster seek times (tens of seconds) but with reduced capacity.
Use Cases:
Backups: Storing copies of data in case of system failures.
Archivals: Keeping records that are rarely accessed but need to be preserved long-term.
Data Transfer: Moving large amounts of data between different systems or locations.
Tape Jukeboxes: Automated systems that manage multiple tapes, providing very large storage capacities (multiple petabytes).
Summary
Understanding physical storage systems involves knowing the different types of storage media, how they are organized, and how they perform. Here's a quick recap:
Storage Types: Volatile (temporary) vs. non-volatile (permanent).
Storage Hierarchy: From fast primary storage to slow, high-capacity tertiary storage.
Interfaces: Standards like SATA, SAS, and NVMe determine how data moves between disks and the computer.
Disk Mechanics: Magnetic disks store data in tracks and sectors, with read-write heads accessing data as the disk spins.
Performance Metrics: Access time, data-transfer rate, IOPS, and MTTF measure how well storage systems perform.
RAID: Combines multiple disks for better performance and reliability, with various RAID levels tailored to different needs.
Optimization Techniques: Buffering, read-ahead, and efficient scheduling improve disk access speeds.
Magnetic Tapes: Offer large storage at low cost but with slower access times, ideal for backups and archives.
By mastering these concepts, you can design and manage storage systems that balance speed, cost, and reliability to meet your data management needs effectively.