Hadoop Distributed file system vs distributed cache
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
The Hadoop ecosystem comprises various components designed to enable processing of large datasets across clusters of computers using simple programming models. Among these components, the Hadoop Distributed File System (HDFS) and the Distributed Cache play critical but distinct roles. Understanding these roles, differences, and how they complement each other can provide a deeper insight into Hadoop’s operational capabilities and optimization strategies.
Hadoop Distributed File System (HDFS)
HDFS is a core component of the Hadoop framework, specifically designed to handle large volumes of data distributed across a cluster of machines. It provides scalable and reliable data storage, designed to span large clusters of commodity servers and to handle the failure of any component seamlessly. By storing data across multiple nodes, HDFS achieves high aggregate data bandwidth and resilience to failure.
Technical Details:
- Fault Tolerance: Data in HDFS is split into blocks (default size is 128MB in Hadoop 2.x), and each block is replicated across multiple nodes (default is three replicas), ensuring high availability and data durability.
- Write-Once-Read-Many: The system is optimized for large batch reads and writes, making it suitable for applications with large datasets.
- Data Locality Optimization: During processing, Hadoop tries to execute data processing tasks on nodes where the data blocks reside, thereby reducing network congestion and increasing overall system performance.
Example Use: Imagine an application processing satellite images to detect geographical features. Large image files are stored in HDFS, split into blocks across different nodes. Data processing frameworks like Apache Spark or Hadoop MapReduce process these blocks in parallel to identify and map features efficiently.
Distributed Cache
In contrast, the Distributed Cache is a facility provided by the MapReduce framework to cache files needed by applications. When you execute a MapReduce job, you can specify files or even archives (zip, tar, etc.) to be cached. Each mapper or reducer task across all nodes in the cluster can then access these cached files, ensuring the data or artifacts needed are locally available, significantly reducing input-output operations across the network.
Technical Details:
- Efficiency: Copies of necessary resources are transferred to node local storage once per job, rather than once per task, reducing the bandwidth consumption and job execution time.
- Local Access: Tasks access cache resources from local storage, not over the network, enhancing speed.
- Types of Cached Data: Includes files (read-only) and archives, which are expanded at the node.
Example Use: Consider a scenario where a MapReduce job processes weather data to predict regional weather patterns. Common reference files, like geographic lookup tables or custom configuration, can be distributed and cached using this facility, making it accessible across all tasks efficiently.
To crystallize the comparison between the Hadoop Distributed File System (HDFS) and Distributed Cache, see the table below:
| Feature | HDFS | Distributed Cache |
| Purpose | Storing and managing data across a cluster. | Caching necessary files for jobs across the cluster. |
| Processing Type | Write-once-read-many models. | Files accessed many times during a single job execution. |
| Reliability | Data is replicated; failure resilient. | Ensures local availability of files to each task. |
| Use Case | Ideal for large files and datasets. | Best for frequently accessed smaller files or scripts. |
Interplay and Use in Hadoop Systems
Despite their differences, HDFS and Distributed Cache are not mutually exclusive and are often used together for optimal data processing. For example, in a MapReduce job, the input data might be stored in HDFS, but the supporting files like binary libraries or configuration files, might be provisioned through Distributed Cache. This combination leverages the decentralized storage capacity of HDFS and the localized efficiency of the Distributed Cache.
By harnessing both the power of HDFS for resilient data storage and the efficiency of Distributed Cache for quick, repeated access to essential files, Hadoop enables robust, scalable, and efficient data processing across clusters. This dual capability is one of the keys to the scalable nature of Hadoop and the solutions built on it.
Related reading
- HDBSCAN difference between parameters
- Help--100 accuracy with LibSVM?
- Help Understanding Cross Validation and Decision Trees
- Help Understanding Cross Validation and Decision Trees
- Hadoop DistributedCache
- Hadoop Is it possible to avoid replication for certain files?
- Hadoop DistributedCache failed to report status
- Hadoop DistributedCache functionality in Spark

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.