← Previous: T12.3: Log-Based Recovery (WAL, Undo/Redo, Checkpoints) and Shadow Paging | 🏠 Index | Next: T13.1: Database Security Threats and Authorization →
T12.4: RAID Levels and Storage Reliability
Topic: T12 — Recovery System & RAID | Priority: 🟠 High | Exam Frequency: 3/7 finals (15 marks across 5 question parts)
Sources: Silberschatz 7e Ch. 12 (§12.5) · Ch. 19 (§19.2.1) · Classnote by Raidah (Pages 32–33)
Why This Topic Matters
Magnetic hard drives and flash SSDs will eventually suffer mechanical wear, surface defects, or head crashes. RAID (Redundant Array of Independent Disks) provides the physical hardware foundation that makes database storage fault-tolerant. This topic explores disk striping for parallel speed, mirroring and parity for fault recovery, comparison across RAID levels 0 through 6, and workload-specific storage designs. It has appeared across 5 separate exam questions in RUET semester finals, carrying 15 marks.
📝 Key Definitions
RAID (Redundant Array of Independent Disks): RAID is a storage organization technique that combines multiple physical disks into a single logical volume to boost I/O speed and protect against drive failures. It uses data striping for parallel read/write throughput and mirroring or parity blocks for hardware fault tolerance.
Mirroring: Mirroring (used in RAID 1) is a redundancy method that pairs every primary disk with an identical duplicate disk. Every write goes to both drives so if one disk fails, the system serves requests from the surviving mirror with zero downtime.
Data Striping: Data striping splits files into fixed-size units (usually blocks) and distributes them cyclically across multiple physical disks. Because multiple drives read and write blocks in parallel, striping greatly increases transfer speed.
Parity Block: A parity block is an error-correcting block computed as the bitwise exclusive-OR (⊕) of all data blocks in a stripe (P=B0⊕B1⋯⊕Bn−1). If any single disk in the stripe fails, the controller reconstructs the lost block on the fly by XOR-ing the surviving blocks with the parity block.
Hot Swapping and Data Scrubbing: Hot swapping lets an administrator pull out a failed disk and insert a replacement drive while the server stays online and rebuilds the data in the background. Data scrubbing is a background check that reads all disk sectors during idle periods and repairs any unreadable sectors using redundant parity or mirror copies.
Core Architectural Features of RAID
A RAID array combines multiple independent physical disks into a single logical volume:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Core Features of RAID Systems │
├─────────────────────────────────────────────────────────────────────────────┤
│ 1. Data Striping Splits data across multiple drives in parallel │
│ 2. Data Redundancy Protects against drive loss via copy or parity │
│ 3. Storage Virtualization Presents multiple disks as one logical volume │
│ 4. Online Hot Swapping Allows disk replacement without powering down │
│ 5. Background Scrubbing Detects and fixes latent bit rot on idle disks │
└─────────────────────────────────────────────────────────────────────────────┘
- Parallel Data Striping: Breaks large files into fixed-size segments (blocks or bytes) distributed across multiple drives. This allows simultaneous read and write operations across independent drive channels, boosting overall I/O bandwidth.
- Hardware Redundancy: Writes duplicate data (mirroring) or mathematical error-correcting codes (parity). If any single drive crashes, data remains accessible without downtime.
- Storage Virtualization: Hides physical multi-disk complexity from the operating system and DBMS engine. The array appears as a single fast, large logical disk drive.
- Online Hot Swapping and Rebuild: Allows system administrators to pull out a defective physical drive and plug in a new one while the database server remains fully online. The controller reconstructs lost data onto the replacement disk in the background.
- Background Data Scrubbing: Periodically scans idle disk sectors to detect unreadable sectors (known as bit rot or latent sector failures) and repairs them using parity before a catastrophic second drive failure occurs.
Architectural Breakdown of RAID Levels
Figure 12.4: RAID levels showing cylinder configurations for RAID 0, RAID 1, RAID 5, and RAID 6 (Silberschatz Figure 12.4).
RAID 0: Non-Redundant Block Striping
- Architecture: Blocks are striped cyclically across all N disks (B0→Disk 0,B1→Disk 1, etc.).
- Redundancy: None.
- Fault Tolerance: 0 disks. If any single drive fails, the entire file system is destroyed.
- Usable Capacity: 100% (N×disk size).
- Use Case: High-performance temporary scratch space and video rendering where data loss is acceptable.
RAID 1: Mirrored Disks
- Architecture: Every primary data disk has an identical duplicate mirror disk. Every write is executed on both drives.
- Redundancy: Complete duplication.
- Fault Tolerance: 1 disk per mirrored pair (survives any single disk failure, and up to N/2 failures if failures occur in different pairs).
- Usable Capacity: 50% (N/2×disk size). Incurs a 100% storage overhead.
- Performance: Excellent read throughput (reads load-balance across either drive) and fast sequential write speed.
- Use Case: Database write-ahead transaction logs (
WAL) and critical operating system volumes.
RAID 1+0 (RAID 10) vs. RAID 0+1 (Nested RAID)
- RAID 1+0 (Striped Mirrors): First pairs disks into RAID 1 mirrors, then stripes data across the mirrored pairs using RAID 0. If a disk fails, all other disks in the array remain active. It survives multiple concurrent disk failures as long as no two failed disks share the same mirror pair.
- RAID 0+1 (Mirrored Stripes): First stripes disks into two RAID 0 arrays, then mirrors one stripe array onto the other. If one disk fails, its entire RAID 0 stripe becomes unusable, forcing all operations onto the surviving stripe. RAID 1+0 is strictly superior and preferred in database deployments.
Legacy Parity Schemes: RAID 2, RAID 3, and RAID 4
- RAID 2 (Bit-Level Striping with Hamming Codes): Stripes individual bits across data drives and uses multiple dedicated ECC parity drives. Obsolete because modern disk sectors include hardware-level error correction.
- RAID 3 (Byte-Level Striping with Dedicated Parity Disk): Stripes data byte-by-byte across data drives, with parity bits stored on a single dedicated parity disk. Every read requires all disks to spin in synchronization, limiting random access performance.
- RAID 4 (Block-Level Striping with Dedicated Parity Disk): Stripes blocks across data disks, with a single dedicated parity disk. It suffers from a severe write bottleneck: every write to any data disk must update the single dedicated parity drive.
RAID 5: Block-Interleaved Distributed Parity
- Architecture: Partitions data and parity blocks across all N+1 disks. It eliminates the RAID 4 write bottleneck by distributing parity blocks circularly across all drives.
- Parity Distribution Pattern: For an array of 5 disks (Disks 0 to 4), the parity block Pk rotates across disks:
| Disk 0 | Disk 1 | Disk 2 | Disk 3 | Disk 4 |
|---|
| P0 | Block 0 | Block 1 | Block 2 | Block 3 |
| Block 4 | P1 | Block 5 | Block 6 | Block 7 |
| Block 8 | Block 9 | P2 | Block 10 | Block 11 |
| Block 12 | Block 13 | Block 14 | P3 | Block 15 |
| Block 16 | Block 17 | Block 18 | Block 19 | P4 |
- Fault Tolerance: Survives the loss of any 1 single disk.
- Intuitive Idea Behind XOR (⊕) Parity:
How can a single parity block P recover any lost data block out of 4 data drives? Recall that bitwise exclusive-OR (⊕) returns
1 when two bits are different and 0 when they are the same. That means P simply sets each bit so the total number of 1s across the row is even. If any one disk crashes, you just look at the surviving disks (including P) and fill in whichever bit (0 or 1) is needed to make the count of 1s even again!
- Parity Calculation (XOR Logic): The parity block P is computed as the bitwise exclusive-OR of all data blocks in the stripe:
P=B0⊕B1⊕B2⊕B3
- Data Reconstruction on Disk Failure: If Disk 1 crashes (losing block B1), the controller recovers B1 on the fly by XOR-ing the surviving blocks with P:
B1=P⊕B0⊕B2⊕B3
- Concrete 4-Bit Mini-Example:
Suppose a 4-disk RAID 5 stripe stores three 4-bit data blocks and one parity block:
- B0=1010, B1=0110, B2=1101
- Parity block: P=1010⊕0110⊕1101=0001
- Now suppose Disk 1 crashes and we lose B1. The controller computes:
B1=P⊕B0⊕B2=0001⊕1010⊕1101=0110
which restores the exact lost bits 0110 without halting the database!
- Small Write Penalty: Updating a single random block requires 2 reads and 2 writes (4 I/Os total): read the old data block Bold and old parity Pold, compute the new parity via
Pnew=Pold⊕Bold⊕Bnew
and write Bnew and Pnew back to disk.
- Usable Capacity: NN−1×total array capacity.
- Use Case: Read-heavy relational databases, web servers, and general data storage.
RAID 6: P + Q Dual Distributed Parity
- Architecture: Extends RAID 5 by computing two independent error-correcting blocks: P (standard XOR parity) and Q (Reed-Solomon code or polynomial matrix multiplication), distributed across all drives.
- Fault Tolerance: Survives up to 2 simultaneous disk failures.
- Usable Capacity: NN−2×total array capacity.
- Small Write Penalty: Higher than RAID 5 (requires 3 reads and 3 writes for small random updates).
- Use Case: Enterprise storage arrays using massive multi-terabyte drives (10 TB+) and long rebuild times.
Comparison Matrix of RAID Levels
| RAID Level | Striping Unit | Redundancy Mechanism | Disks Tolerated | Usable Storage Efficiency | Sequential Read Speed | Random Write Speed | Primary Enterprise Use Case |
|---|
| RAID 0 | Block | None | 0 | 100% | Very Fast | Very Fast | Temporary scratch space, video editing caches |
| RAID 1 | Block / Drive | Mirroring (1:1 copy) | 1 per pair | 50% | Fast | Fast (sequential) | Transaction logs (WAL), boot volumes |
| RAID 1+0 | Block | Mirroring + Striping | 1 per pair | 50% | Very Fast | Fast | High-performance OLTP transactional databases |
| RAID 3 | Byte | Dedicated Parity Disk | 1 | NN−1 | Fast (large) | Slow | Legacy media streaming systems (obsolete) |
| RAID 4 | Block | Dedicated Parity Disk | 1 | NN−1 | Fast | Bottlenecked | Specialized NetApp WAFL storage |
| RAID 5 | Block | Distributed Parity (P) | 1 | NN−1 | Very Fast | Moderate (penalty) | Read-heavy web databases, file servers |
| RAID 6 | Block | Distributed P+Q Parity | 2 | NN−2 | Very Fast | Slower (penalty) | Massive multimedia archives, multi-TB arrays |
Workload-Based Selection: The Multimedia Archive Case
Semester exam 2024 Q.7(c) tests how to choose a RAID level for a specific application: a multimedia archive containing very large image and video files.
1. Workload Characteristics
- Very Large File Sizes: Files range from megabytes to gigabytes.
- Read-Dominated Access: Workload consists of continuous sequential streaming and downloads. Updates are rare (write-once, read-many).
- Enormous Storage Footprint: The archive requires massive disk capacity, making per-gigabyte hardware cost a dominant factor.
- Extended Rebuild Windows: Massive 10 TB+ hard drives can take 24 to 72 hours to rebuild after a drive failure. During this prolonged rebuild window, surviving drives face heavy read stress, sharply raising the probability of a second drive failure or latent sector error.
2. Evaluation of Candidates
- RAID 0: Disqualified immediately. Zero fault tolerance risks losing the entire archive.
- RAID 1 or RAID 1+0: Disqualified due to cost. Mirroring wastes 50% of purchased raw disk capacity, which is financially prohibitive for multi-petabyte archives.
- RAID 5: Offers high capacity (NN−1) and fast sequential reads. However, if a second disk fails or a latent read error occurs during the multi-day rebuild of a 14 TB drive, all data is permanently lost.
- RAID 6: The Recommended Level. RAID 6 offers the high storage efficiency of parity while tolerating two simultaneous disk failures. The archive easily survives a second drive crash during an extended rebuild operation.
Significance of RAID in Database Recovery
RAID works hand-in-hand with the database recovery manager to keep data safe:
┌─────────────────────────────────────────────────────────────────────────────┐
│ How RAID Intersects with DBMS Recovery │
├─────────────────────────────────────────────────────────────────────────────┤
│ 1. Physical Implementation of Stable Storage │
│ DBMS WAL recovery algorithms theoretically assume stable storage exists.│
│ RAID mirroring (RAID 1) and parity (RAID 5/6) provide this reality. │
├─────────────────────────────────────────────────────────────────────────────┤
│ 2. Prevention of Catastrophic Offline Restores │
│ Without RAID, a disk crash requires halting the database, restoring an │
│ offline backup, and replaying days of logs. RAID avoids all downtime. │
├─────────────────────────────────────────────────────────────────────────────┤
│ 3. Non-Stop Online Background Rebuilds │
│ Hot spares and background rebuild allow active queries and transactions │
│ to execute unhindered while a failed disk is physically reconstructed. │
├─────────────────────────────────────────────────────────────────────────────┤
│ 4. Dedicated Transaction Log Protection │
│ Placing WAL log files on dedicated RAID 1 arrays guarantees rapid disk │
│ writes without parity calculation latency, ensuring durability. │
└─────────────────────────────────────────────────────────────────────────────┘
Exam Variants
The table below summarizes all past exam questions on RAID levels and storage reliability:
| Year & Question | Marks | Scenario / Data Given | Key Result / Answer Summary |
|---|
| 2018 Q.5(c) (Part 2) | 2 | How does RAID model help to recover a system? | Explains disk fault tolerance: instant failover via mirroring, on-the-fly parity reconstruction (XOR), and online hot-spare rebuilds. |
| 2018 Q.8(c) | 3 | Describe the different RAID levels | Details RAID 0, 1, 5, and 6 architectures, striping, redundancy mechanisms, fault tolerance, and includes Figure 12.4 diagram. |
| 2023 Q.4(a) | 4 | Discuss the features of RAID models | Details 5 key features: parallel striping, hardware redundancy, storage virtualization, online hot swapping, and background data scrubbing. |
| 2023 Q.7(c) | 3 | Describe RAID model and its significance in database recovery | Defines RAID, then explains its role: implementing stable storage, avoiding offline tape restores, providing non-stop availability, and protecting logs. |
| 2024 Q.7(c) | 3 | Multimedia archive with very large video/image files, compare levels | Analyzes media workload (sequential reads, massive storage, rare writes), provides comparison table, and recommends RAID 6 with justification. |
🏆 Golden Questions (Past Exam Archive)
🎯 GQ1 · 2018 Q.5(c) [Part 2] · How RAID Helps System Recovery
Appeared: 2018 Q.5(c) [Part 2] (2 of 4 marks) — Section B
Question:
Discuss each type of failure that can happen in DBMS. How does RAID model help to recover a system?
(Note: This is Part 2 covering RAID recovery for 2 marks. For Part 1 on DBMS failure classification, see T12.01).
Full Answer:
The RAID (Redundant Array of Independent Disks) model protects a database system from disk and physical media failures through three primary mechanisms:
- Immediate Failover via Mirroring (RAID 1): When a primary hard drive suffers a head crash or mechanical failure, the controller routes I/O requests to the identical mirror drive immediately. The database stays fully operational with zero downtime and zero data loss.
- On-the-Fly Parity Reconstruction (RAID 5 and RAID 6): If a drive in a RAID 5 or RAID 6 array fails, the storage controller recalculates lost data blocks on the fly using a bitwise XOR of the surviving data blocks and parity blocks. Database queries continue reading data without interruption.
- Transparent Online Rebuild with Hot Spares: The system copies reconstructed data onto a standby spare disk in the background while transactions run normally. The repair completes without taking the database offline.
🎯 GQ2 · 2018 Q.8(c) · Description of RAID Levels
Appeared: 2018 Q.8(c) (3 marks) — Section B
Question:
Describe the different RAID levels.
Full Answer:
Figure 12.4: RAID levels showing cylinder configurations for RAID 0, RAID 1, RAID 5, and RAID 6 (Silberschatz Figure 12.4).
RAID organizes multiple physical disks into a single logical volume to balance I/O throughput, capacity, and fault tolerance. The primary RAID levels are:
-
RAID 0 (Block Striping, No Redundancy):
- Data blocks are striped evenly across N disks.
- Provides very high read and write throughput due to parallel access.
- Offers zero fault tolerance. If any single drive fails, all data is lost.
-
RAID 1 (Disk Mirroring):
- Every primary disk has a duplicate mirror disk. Writes are duplicated across both drives.
- Survives the failure of any single disk in a pair.
- Uses 50% of total disk capacity for redundancy.
-
RAID 5 (Block-Interleaved Distributed Parity):
- Data blocks and parity blocks are distributed circularly across all N+1 disks, eliminating dedicated parity disk write bottlenecks.
- Tolerates the failure of any 1 disk using bitwise XOR parity reconstruction (Blost=P⊕Bsurviving).
- Storage overhead is low: only N+11 of total capacity.
-
RAID 6 (P + Q Dual Distributed Parity):
- Similar to RAID 5, but stores two independent error-correcting codes (P parity and Q Reed-Solomon codes) across all drives.
- Tolerates up to 2 simultaneous disk failures.
(Legacy levels include RAID 2 with bit-level Hamming codes, RAID 3 with byte-level striping and a dedicated parity disk, and RAID 4 with block-level striping and a dedicated parity disk).
🎯 GQ3 · 2023 Q.4(a) · Architectural Features of RAID Models
Appeared: 2023 Q.4(a) (4 marks) — Section A · CLO1
Question:
Discuss the features of RAID models.
Full Answer:
A Redundant Array of Independent Disks (RAID) provides five primary architectural features that enhance storage performance, reliability, and maintainability:
-
Parallel Data Striping (Performance Enhancement):
- Divides data into contiguous segments (blocks or bytes) and writes them across multiple physical drives in parallel.
- Enables simultaneous data transfer across independent disk channels, speeding up large sequential transfers and load-balancing multiple concurrent small accesses.
-
Data Redundancy and Fault Tolerance:
- Incorporates redundancy through disk mirroring (RAID 1) or distributed parity codes (RAID 5 and 6).
- Protects against drive failures: lost data blocks are reconstructed on the fly using XOR logic without taking the system down.
-
Storage Virtualization:
- Presents an array of multiple physical drives to the operating system and DBMS as a single, contiguous, high-capacity logical drive.
- Database applications issue standard block read and write requests without managing individual disk mechanics.
-
Online Rebuild and Hot Swapping:
- Supports removing and replacing failed physical disk drives while the server remains powered on and serving queries.
- The RAID controller automatically rebuilds data onto standby hot-spare drives in the background.
-
Background Data Scrubbing:
- Continuously reads idle disk sectors in the background to detect latent sector corruption (bit rot).
- Automatically repairs damaged sectors from redundant parity blocks before additional disk failures occur.
🎯 GQ4 · 2023 Q.7(c) · RAID Model and Significance in Database Recovery
Appeared: 2023 Q.7(c) (3 marks) — Section B · CLO2
Question:
Briefly describe the RAID model and its significance in database recovery.
Full Answer:
1. Description of the RAID Model
The RAID (Redundant Array of Independent Disks) model combines multiple physical disk drives into a single logical storage unit. It uses data striping to achieve high parallel throughput and data redundancy (via disk mirroring or distributed parity) to protect against media loss.
2. Significance in Database Recovery
RAID supports the database recovery subsystem in four major ways:
- Physical Implementation of Stable Storage: Standard database recovery algorithms (such as Write-Ahead Logging) assume the existence of stable storage that survives system crashes and media defects. RAID mirroring (RAID 1) and parity arrays (RAID 5/6) make this theoretical assumption a physical reality in modern hardware.
- Eliminates Costly Offline Restores: When a physical hard drive fails in a non-RAID environment, the database must shut down. Administrators must replace the drive, restore the last archival backup, and replay days of transaction logs. RAID maintains continuous operation, eliminating hours of downtime.
- High Availability During Rebuild: While the controller reconstructs lost data onto a hot spare in the background, user transactions continue reading and writing data without interruption.
- Guarantees Transaction Log Durability: Write-ahead logs (
WAL) are typically hosted on dedicated RAID 1 volumes. RAID 1 provides fast sequential write performance while ensuring that transaction commit records survive physical drive destruction.
🎯 GQ5 · 2024 Q.7(c) · Multimedia Archive RAID Comparison & Recommendation
Appeared: 2024 Q.7(c) (3 marks) — Section B · CO3
Question:
A multimedia archive contains very large image and video files. RAID is recommended for storage. Compare different RAID levels.
Full Answer:
1. Workload Characteristics of a Multimedia Archive
- Very Large File Sizes: Files consist of high-resolution images and large multi-gigabyte video streams.
- Access Pattern: Read-intensive workload dominated by high-bandwidth sequential reads (streaming and downloading). Updates are rare (write-once, read-many).
- Storage Footprint: Requires massive storage capacity. Keeping per-terabyte hardware costs manageable is essential.
- Prolonged Rebuild Times: Rebuilding large modern hard drives (such as 12 TB to 18 TB drives) takes several days, increasing the risk of a second drive failure during rebuild.
2. Comparison of RAID Levels
| RAID Level | Redundancy Mechanism | Fault Tolerance | Usable Capacity | Sequential Read Speed | Suitability for Multimedia Archive |
|---|
| RAID 0 | None (Striped) | 0 disks | 100% | Very Fast | Unacceptable: Any disk failure permanently destroys the archive. |
| RAID 1 | Mirroring (1:1 Copy) | 1 disk per pair | 50% | Fast | Poor: 50% storage overhead is cost-prohibitive for massive media archives. |
| RAID 5 | Distributed Parity (P) | 1 disk | NN−1 (High) | Very Fast | Acceptable: Excellent read throughput and capacity efficiency. Vulnerable to double failure during long rebuilds. |
| RAID 6 | Distributed P+Q Parity | 2 disks | NN−2 (High) | Very Fast | Best: High capacity efficiency plus double-disk fault tolerance during lengthy multi-day rebuilds. |
| RAID 1+0 | Mirroring + Striping | 1 disk per pair | 50% | Very Fast | Too Expensive: Wastes half of purchased disk capacity. |
3. Recommendation and Justification
- Recommended Level: RAID 6 (or RAID 5 for smaller arrays).
- Justification: Multimedia archives demand high storage capacity efficiency and high sequential read bandwidth, making parity schemes far more economical than mirroring. Because multi-terabyte drives take days to rebuild, RAID 6 is strongly recommended over RAID 5: its dual P+Q parity ensures the archive survives an unrecoverable read error or a second drive crash during an extended rebuild.
📖 High-Yield Exercises from the Book
🎯 HYE-01 · Practice Exercise 12.4 · RAID 4 vs RAID 5 Parity Block Distribution
Source: Silberschatz 7e · Chapter 12 (Practice Exercise 12.4)
Exam Relevance: High-Probability Exam Diagram & Architecture Question
Key Tested Concept: Block-level striping, parity bottleneck in RAID 4, and distributed parity allocation in RAID 5.
Problem Statement:
Consider an array of 4 disks.
- Draw diagrams showing how data blocks D0,D1,…,D8 and parity blocks P0,P1,P2 are arranged across the 4 disks in RAID Level 4 versus RAID Level 5.
- Explain why RAID Level 4 suffers from a write bottleneck on the parity disk.
- Explain how RAID Level 5 resolves this bottleneck.
Model Exam-Style Solution:
-
Block Arrangement Diagrams (4 Disks: Disk 0, Disk 1, Disk 2, Disk 3):
- RAID Level 4 (Dedicated Parity Disk):
- Data blocks are striped across Disks 0, 1, and 2.
- Disk 3 is a dedicated parity disk holding all parity blocks Pi.
Disk 0 Disk 1 Disk 2 Disk 3 (Parity)
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ D0 │ │ D1 │ │ D2 │ │ P0 (0-2) │
├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤
│ D3 │ │ D4 │ │ D5 │ │ P1 (3-5) │
├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤
│ D6 │ │ D7 │ │ D8 │ │ P2 (6-8) │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
- RAID Level 5 (Distributed Parity):
- Parity blocks are rotated round-robin across all disks, eliminating any single parity disk.
Disk 0 Disk 1 Disk 2 Disk 3
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ D0 │ │ D1 │ │ D2 │ │ P0 (0-2) │
├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤
│ D3 │ │ D4 │ │ P1 (3-5) │ │ D5 │
├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤
│ D6 │ │ P2 (6-8) │ │ D7 │ │ D8 │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
-
The RAID 4 Parity Write Bottleneck:
- In RAID 4, every write to any data block (whether on Disk 0, 1, or 2) requires updating the corresponding parity block on Disk 3:
Pnew=Pold⊕Dold⊕Dnew
- Even if concurrent writes access completely independent data blocks on different data disks (e.g., D0 on Disk 0 and D4 on Disk 1), both writes must update Disk 3.
- Therefore, the single dedicated parity disk becomes an severe I/O bottleneck, limiting the maximum write throughput of the entire RAID array to the speed of one disk!
-
How RAID 5 Resolves the Bottleneck:
- In RAID 5, parity blocks are distributed evenly across all N disks.
- For example, writing D0 updates parity P0 on Disk 3, while writing D3 updates parity P1 on Disk 2.
- Because parity blocks reside on different physical drives, multiple independent writes can proceed fully in parallel, completely eliminating the single-disk bottleneck. ■
💡 RUET Exam Takeaway:
Draw the 4-column disk grid clearly! Notice the diagonal shift of the parity block Pi in the RAID 5 diagram—examiners look specifically for this round-robin pattern.
🎯 HYE-02 · Exercise 12.13 · RAID 1 Mirroring vs RAID 5 for Database Workloads
Source: Silberschatz 7e · Chapter 12 (Exercise 12.13)
Exam Relevance: Prime Overdue Systems Engineering Question
Key Tested Concept: The RAID 5 "Small Write Penalty" (2 reads + 2 writes) vs RAID 1 mirroring under random OLTP workloads.
Problem Statement:
A database application performs heavy random small updates (such as updating individual account balances in an OLTP banking system).
- Compare RAID Level 1 (Mirroring) and RAID Level 5 (Distributed Parity) for this workload in terms of storage efficiency and write I/O operations.
- Explain the "Small Write Penalty" of RAID 5 mathematically.
- Which RAID level is superior for high-concurrency OLTP databases, and why?
Model Exam-Style Solution:
-
Storage Efficiency Comparison:
- RAID 1 (Mirroring): Requires 2N disks to store N disks of data. Storage efficiency is only 50%. Half of total disk capacity is consumed by duplicates.
- RAID 5 (Parity): Uses 1 disk equivalent out of N disks for parity. Storage efficiency is:
Efficiency=NN−1
For an 8-disk array, efficiency is 7/8=87.5%. RAID 5 is far more cost-effective in raw capacity.
-
The "Small Write Penalty" of RAID 5:
- When a transaction performs a random update to a single block Dold (a "small write"):
- It does not rewrite the entire stripe.
- To compute the new parity block Pnew without reading all other data disks in the stripe, RAID 5 uses the algebraic XOR identity:
Pnew=Pold⊕(Dold⊕Dnew)
- To accomplish this, the disk controller must perform 4 distinct physical I/O operations:
- Read Dold from data disk.
- Read Pold from parity disk.
- Compute Pnew in controller memory.
- Write Dnew to data disk.
- Write Pnew to parity disk.
- Summary: Every single logical small write generates 2 physical disk reads and 2 physical disk writes (4 total I/O operations)!
-
Comparison with RAID 1 for OLTP Workloads:
- In RAID 1 (Mirroring), a write to a data block simply writes to Disk A and Disk B.
- Physical I/O count for RAID 1: 2 physical writes (and 0 reads).
- Furthermore, both writes in RAID 1 are parallel writes with zero read-before-write latency.
- In high-concurrency OLTP databases (like bank transaction systems), the random write latency and 4x I/O multiplication of RAID 5 severely degrades transaction throughput.
- Verdict: RAID 1 (or RAID 10 / RAID 1+0) is vastly superior for high-performance write-intensive database applications despite its higher disk cost. ■
💡 RUET Exam Takeaway:
Remember the formula: 1 Small Write in RAID 5 = 2 Reads + 2 Writes = 4 Disk I/Os. This exact mathematical calculation earns full marks.
⚡ Exam Tips & Common Mistakes
- Never Claim RAID 0 Provides Fault Tolerance: RAID 0 provides zero redundancy. A single drive failure destroys all data in the array.
- Parity Write Penalty: Remember that updating a single small block in RAID 5 requires 2 block reads and 2 block writes (4 I/O operations total). This penalty does not harm large sequential writes.
- RAID Does Not Replace DBMS Transaction Logs: RAID protects against physical drive crashes. It does not protect against software bugs, accidental
DROP TABLE queries, or transaction aborts. The DBMS still requires Write-Ahead Logging.
- Multimedia Workload Recommendation: For multimedia archive questions, never recommend RAID 1 or RAID 1+0 (too much wasted storage) or RAID 0 (zero protection). Always recommend RAID 6 or RAID 5, citing sequential read speed, high usable capacity, and long drive rebuild windows.
🔗 Related Topics
← Previous: T12.3: Log-Based Recovery (WAL, Undo/Redo, Checkpoints) and Shadow Paging | 🏠 Index | Next: T13.1: Database Security Threats and Authorization →