System design paper · 2003
Google File System
How Google stored huge files on thousands of cheap machines that break daily: one master that knows where everything is, and servers that move the data.
You’ll learn to
- Explain how a file is cut into 64 MB chunks, copied three times and found through one master.
- Trace a write through a primary copy and a chain of servers, and say why data and orders travel separately.
- Describe what record append promises, and what a reader must do about padding and duplicates.
- Name what later systems kept from the design and what Google replaced.
The idea in short
Google needed to store files of many gigabytes on thousands of cheap machines, some of which break every day. Its answer was to cut each file into pieces of 64 MB, called chunks, keep three copies of every chunk on different machines, and let one machine, the master, remember where every chunk lives.
The master only hands out addresses. The data itself moves directly between the programs that use the file system (the clients) and the storage machines, so one master can serve a whole cluster (the group of machines running the file system). The design also gives up some guarantees of an ordinary file system, because Google’s programs mostly add data to the end of files and can cope with the gaps that leaves.
The problem
In the early 2000s Google’s business was reading, sorting and rebuilding enormous piles of data: copies of web pages and the intermediate results of the jobs that processed them. The authors say that by the time of the paper the largest clusters had over 1,000 storage machines and over 300 TB of disk, with hundreds of programs using them at once.
No off-the-shelf file system fitted. The authors list four observations about their own workload, and every later choice follows from them.
- Failures are normal. The machines were built from cheap parts, called . With thousands of them, the paper says, some are always broken and some “will not recover from their current failures”. They saw bugs in programs and operating systems, human mistakes, and failing disks, memory, cables and power supplies. Monitoring and automatic repair had to be part of the file system, not an add-on.
- Files are huge. Files of many gigabytes were common, each holding millions of small items such as web documents. Managing billions of KB-sized files one by one would be unwieldy, so the usual design around small blocks (the few-KB units a file system reads and writes at a time) needed rethinking.
- Files grow at the end. Most files were written by adding data to the end. Overwriting the middle of a file almost never happened. Once written, files were often only read, and only sequentially. That makes adding data the operation worth making fast and safe. Keeping a cache of file data on the client (a store of recent answers, so repeat requests skip the slow path) loses its appeal, and the paper adds that working sets are often too large to cache.
- Google writes both sides. The same company builds the file system and the programs that use it, so it can change the file system’s promises when that makes things simpler for everyone.
The paper turns these into a short list of assumptions. A cluster stores a modest number of large files, perhaps a few million, each typically 100 MB or more. Reads are either long streaming reads of 1 MB or more, or small random reads of a few KB. Writes are mostly large appends. Many machines, sometimes hundreds, append to the same file at once, so that needs to work without heavy coordination. Steady throughput matters more than the speed of any one request.
So the question is: how do you build a file system for huge, append-heavy files on machines that fail constantly, without paying for the guarantees your programs do not need?