Saving capacity with HDFS RAID

Visit the post for more.

Hairong Kuang
8 min readbeginner
--
View Original

Overview

The article discusses the implementation of HDFS RAID at Facebook to enhance data storage efficiency by reducing the replication factor of files in HDFS. It highlights the use of Erasure Codes, specifically XOR and Reed-Solomon, to save tens of petabytes of storage capacity while maintaining data safety.

What You'll Learn

1

How to implement HDFS RAID to reduce data replication overhead

2

Why directory RAID can solve the small file problem in HDFS

3

How to enhance data reliability in HDFS using RAID block placement policies

Prerequisites & Requirements

  • Understanding of HDFS and data replication concepts
  • Familiarity with map/reduce jobs in HDFS(optional)

Key Questions Answered

What are the benefits of using HDFS RAID?
HDFS RAID reduces the replication factor of files, which leads to significant storage savings. By implementing Erasure Codes like XOR and Reed-Solomon, data safety is maintained while achieving effective replication factors of 2.2 for XOR and 1.4 for Reed-Solomon, resulting in tens of petabytes of capacity savings.
How does directory RAID address the small file problem?
Directory RAID treats all files under a leaf directory as a single file, allowing for RAID to be applied even when individual files are too small to benefit from traditional RAID. This approach enables space savings by grouping file blocks and generating a single parity file for the entire directory.
What challenges are associated with deploying RAID in large HDFS clusters?
Challenges include data corruption from bugs in RAID reconstruction logic, the time-consuming process of RAIDing large directories, and the need to handle changes in directory contents. Strategies such as parallelizing RAID processes and storing checksums in MySQL help mitigate these issues.
What improvements are planned for HDFS RAID in the future?
Future improvements include integrating RAID natively into HDFS to eliminate the need for separate RAID nodes, allowing files to be RAIDed upon creation. This change aims to enhance efficiency by reducing disk I/Os and ensuring that parity files are consistently moved with their source files.

Key Statistics & Figures

Effective replication factor for XOR RAID
2.2
Achieved by maintaining two replicas for parity blocks and ten for source data.
Effective replication factor for Reed-Solomon RAID
1.4
Achieved by maintaining one replica for the source file and four for parity blocks.
Percentage of small files in production cluster
more than 50%
Indicates a significant portion of files that cannot benefit from RAID.
Total capacity savings achieved by HDFS RAID
tens of petabytes
Realized by reducing the overall replication factor across the cluster.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Storage
Hdfs
Used as the underlying distributed file system for data storage.
Database
Mysql
Used for storing CRC checksums to verify data integrity during RAID processes.

Key Actionable Insights

1
Implementing directory RAID can significantly improve storage efficiency in HDFS environments with many small files.
This approach is particularly useful when dealing with Hive data, where files are often small and numerous. By treating directories as single units, you can reclaim storage that would otherwise be wasted.
2
Regularly monitor and address data corruption issues by implementing checksum verification during RAID processes.
Using MySQL to store CRC checksums ensures that any reconstructed blocks can be verified for integrity, which is crucial for maintaining data reliability in production environments.
3
Consider parallelizing RAID processes to handle large directories more efficiently.
By using a mapper-only map/reduce job, you can significantly reduce the time required to RAID large directories, allowing for quicker recovery and less wasted CPU time in case of failures.

Common Pitfalls

1
Failing to account for the small file problem can lead to underwhelming storage savings when implementing RAID.
Over half of the files in the production cluster were identified as small files, which could not be RAIDed. This highlights the importance of analyzing file sizes before deployment to ensure RAID strategies are effective.
2
Data corruption during RAID reconstruction can compromise data integrity.
Past experiences showed that bugs in the RAID logic led to data corruption, emphasizing the need for robust verification mechanisms like checksum storage.

Related Concepts

Erasure Codes
Data Replication Strategies
Data Integrity Verification
Map/Reduce Framework