← Home

Summary of GFS

2021/12/05

The different assumptions and technological environment of GFS with old distributed file system:

Components

One interesting about GFS is it doesn't distinguish between normal and abnormal termination. So it's a crash-only software.

Read/Write

When clients write data, it gets chunk locations(for example, server A, B, C) from master, then choose a closest chunkserver(let's say server A), chunkserver A receives the data, save it in the LRU buffer and transfer the data to a closest chunkserver B at the same time it receives the data. This pipeline is used to minimize the latency and maximizing the bandwidth. When all the 3 chunkservers receive the data, client sends a request to primary(for example server B, which gets a lease to become primary of this chunk from master), then primary will send a request with a consistent order for all the file data to all secondaries(A and C). After receiving the request, the file data is finally wrote into chunks.

Data flow and control flow are decoupled for network efficiency.

Concurrent writes may result in failures, GFS doesn't keep every chunk replica byte-wise identical, each chunk may have padding or duplicate data(when client appends fail, it'll retry, even though some chunkserver may already write them). The client API will handle padding, but leave the duplicates to client code.

When clients read data, the chunk server will compare the in-memory checksums with the chunks to ensure data is not corrupted.

Master operation

Master handles chunk location management, replicates replicas based on different priorities, rebalance chunks and garbage collection. When doing all these operations, master needs to consider chunkserver's disk utilization, network bandwidth and physical server distribution.

The default behavior of file deletion is just to rename the file to another location, wait for 3 days then actually "deleted". This has many benefits:

The backwards of GC is slow reclamation of disk, then GFS provides a option to delete the file again to reclaim the storage immediately, and some different reclamation policies.

Other materials

http://nil.csail.mit.edu/6.824/2020/notes/l-gfs.txt

https://queue.acm.org/detail.cfm?id=1594206

https://cloud.google.com/blog/products/storage-data-transfer/a-peek-behind-colossus-googles-file-system

https://www.systutorials.com/colossus-successor-to-google-file-system-gfs/