YaDFS (Yet another Distributed File System) is inspired by the Google File System (GFS), a technology developed by Google to handle vast amounts of data with efficiency and reliability. GFS was designed to support Google’s intensive data processing needs, such as web crawling and indexing the web, by distributing storage across many machines while ensuring fault tolerance and high availability.
Key Features of the GFS
- GFS is a file system that is distributed in nature, and tailored for handling large files and batch-processing workloads.
- Multiple machines store copies of every file and multiple machines try to read/write the same file.
- Its architecture consists of a single master server and multiple chunkservers, where data is stored in 64MB chunks.
- The master server manages metadata, including file and chunk namespaces, chunk locations, and replica information.
- To maintain high availability, GFS replicates data across multiple chunkservers and server racks, ensuring that data remains accessible even if individual machines or disks fail.
- The system is optimized for reading (specifically large streaming reads) or appending because web crawling and indexing heavily rely on these operations.
GFS Architecture
![image](https://private-user-images.githubusercontent.com/95576716/348125579-f0a0baff-2ef1-4b4e-a647-804d8380a445.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQyNTE0NzIsIm5iZiI6MTcyNDI1MTE3MiwicGF0aCI6Ii85NTU3NjcxNi8zNDgxMjU1NzktZjBhMGJhZmYtMmVmMS00YjRlLWE2NDctODA0ZDgzODBhNDQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIxVDE0MzkzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY4OTFiY2FhODk0OGYzMGVhZWQ5NmZkZGYwYzk5OWFlZTVmODc0NTQ3YWI1YWM5MjEwMDg4ZDMyNWEwMDBkZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u56pdGmOWQF6YTVG5KaLkVr-wnszLG-BiYFu4wfGO24)
Challenges and Evolution
Despite its robust design, GFS faced scalability challenges as Google’s data needs grew. The single master server became a bottleneck, and the system struggled with memory limitations and increased latency for user-facing applications. These limitations led to the development of successor technologies like Colossus, which introduced distributed metadata management using BigTable, enhancing scalability and performance.
YaDFS leverages the foundational principles of GFS. Developed using Python, Flask, MongoDB, and Docker, YaDFS facilitates efficient file operations, health monitoring, and metadata persistence. Docker containers ensure portability and scalability, making it easier to manage distributed files across various environments.
YaDFS Features
- Upload file (upload_file)
- Download file (get_file)
- Both upload_file and get_file are coordinated by the NameNode in YaDFS (in Hadoop/GFS, NameNode handles only metadata operations)
- Multithreaded NameNode with the capability of monitoring the health status of the DataNodes/chunkservers with a heartbeat mechanism.
- Metadata persistence ensured using MongoDB.
- File system commands are supported: list_directories (ls), create_directory (mkdir), get_directory, delete_file, delete_folder, move_file, move_folder, copy_file.
- A custom CLI is developed using Python. This is the client-side interface to send instructions like create_directory, upload_file, and get_file to the NameNode.
- get_info: Gives info on the distributed chunk organization.
- datanode_status: Gives the status of all the DataNodes present in the system.
- Replication of chunks is made to ensure High Availability of chunks and faster, parallel chunk reads. During the FileWrite process: replication of each chunk and its distribution is done on a completely different thread. (Replication Factor (rf) = 3).
- chunks and replication_chunks are collections: that hold the metadata related to chunk storage. it stores all of them in a linear fashion. one chunk after the other regardless of the file. -future improvement: tree like database storage sturcture for faster retrieval of chunk metaData.
- re_replicate : is a manual way to re-replicate chunks; in case there is under-replication, especially when multiple DataNodes fail; and the get_file endpoint fails
- delete_folder has a recursive deletion capability: deleting all files within it, the file metadata and file chunks and replicated chunks located in different DataNodes.
- All this has been dockerized. A custom number of DataNodes can be churned up just by adding another service in docker-compose.
- Variable chunk-size: determined based on the "Number of chunks" parameter requested by the user.
- M chunks are mapped onto N DataNodes using a simple Round Robin Algorithm
YaDFS Architecture
ScreenShots
https://medium.com/@dhammikasamankumara/what-is-hadoop-distributed-file-system-hdfs-36a3503f9c60