Distributed File System System Design: The 45-Minute Interview Walkthrough

- Three-tier separation keeps the master out of the data path: clients fetch metadata once, then stream bytes directly to chunk servers.
- The 8-step write path splits data flow (pipeline chain to all replicas) from control flow (primary only), which is what most candidates describe incorrectly.
- Metadata memory is the primary scaling ceiling: at 64 bytes per chunk, a billion chunks needs 64 GB of RAM on a single master. Google solved this in Colossus by moving metadata to Bigtable.
- Rack-aware replication places replicas across two racks to survive both node and rack failures without tripling cross-rack bandwidth.
- Erasure coding vs replication: 3x replication for hot data (fast recovery), Reed-Solomon 6+3 for cold archives (1.5x storage overhead vs 3x).
- GFS consistency model: serial appends are "defined," concurrent writes are "consistent but undefined" - the tradeoff that lets throughput-first systems avoid distributed locking.
You have thirty seconds, a blank whiteboard, and a prompt that says "design a distributed file system." Half the room starts drawing boxes immediately. The other half asks questions first. Both groups draw eventually. Only one group draws the right system.
This walkthrough covers every stage of the distributed file system system design interview: requirements scoping, the architecture that actually works, the write path most candidates butcher, how failure recovery works, the bottlenecks that show up at scale, and the tradeoffs you need to name out loud. Use it as the skeleton for your 45-minute session.
Scope the Distributed File System Design Before You Draw Anything
Distributed file systems span a huge range. A system for user documents (think Google Drive) has almost nothing in common with one storing multi-petabyte ML training data (think HDFS or GFS). Before touching the whiteboard, nail down the functional requirements with your interviewer.
Questions worth asking:
- What kind of clients? Humans uploading documents, or applications streaming large binary files?
- Read-heavy or write-heavy? Append-only or in-place updates?
- Consistency requirements? Is it okay for a read to return stale data for a few seconds?
- File size distribution? Mostly small files or large files? Both?
For this walkthrough, assume the GFS model: the workload is large files (tens of megabytes to gigabytes), sequential reads and appends dominate, and we can tolerate relaxed consistency in exchange for throughput. This is the canonical interview target, and the answers that follow are shaped by these choices.
On the non-functional side: high durability (data survives node and rack failures), high throughput for sequential I/O, automatic fault recovery, and horizontal scalability to petabyte scale.
Anchor the Design With Numbers
Scale estimation gives you the constraints that drive architecture decisions. Sketch these numbers at the top of your whiteboard and refer back to them.
- 1 billion files, average size 100 MB. Total storage: 100 PB.
- 10,000 concurrent write operations per second.
- 100,000 read operations per second (reads outnumber writes 10:1).
- Replication factor 3: raw storage needed = 300 PB.
A single machine has maybe 100 TB of disk. You need at minimum 3,000 storage nodes just for raw capacity. Every constraint that flows from here, including the single-master design, exists to serve these 3,000 nodes without drowning in coordination overhead.
Three Tiers: The Architecture in One Sentence
Three layers. That is all.
Clients → Master (Metadata) → Chunk Servers (Data)
The master holds the entire file system namespace in memory: every file name, every directory, every mapping from file to chunk IDs, and every mapping from chunk IDs to the servers that hold them. The master never touches data.
The chunk servers store the actual bytes on local disk, organized into fixed-size chunks (64 MB in GFS, 128 MB in HDFS). Each chunk is replicated across multiple servers.
Clients talk to the master for metadata, then bypass it entirely for data. This separation is the load-bearing design decision. The master is the control plane. Chunk servers are the data plane. If clients routed data through the master, it would collapse instantly at scale.
Thin dashed: metadata (control plane). Thick solid: data (data plane). The master never sees a byte of file content.
The Metadata Server: More Powerful Than It Looks
One master holding everything in memory sounds like a single point of failure. It is. In distributed systems, "single point of failure with a good recovery story" is considered fine.
The distributed systems engineer's mental model: yes, it's a SPOF. No, it's not as bad as you think.
First, the master logs every mutation to an operation log on disk and across replica machines before acknowledging it. If the master crashes, it replays the log from the last checkpoint (written periodically in the background). Restart time is typically a few seconds.
Second, shadow masters maintain a near-current copy of the master's state and serve read-only requests while the primary is down. They're slightly stale, which is acceptable for most metadata reads.
The real limit of a single master is memory, not availability. Each chunk's metadata entry takes roughly 64 bytes in memory. At 1 billion chunks, that's 64 GB of RAM just to remember where you put your data. This is why block size matters: 128 MB chunks produce 8x fewer metadata entries than 16 MB chunks for the same dataset. GFS clusters at Google topped out at around 50 million chunks before the memory ceiling became painful.
Google's successor system, Colossus (2010), solved this by storing metadata in Bigtable, a distributed key-value store. This allowed the metadata tier to scale horizontally. For your interview, mentioning this evolution shows you understand the bottleneck and know what comes after.
The Write Path: Where Candidates Get It Wrong
Most candidates describe writes as "client sends data to master, master distributes to replicas." That is wrong. It also tells the interviewer you haven't thought about throughput. The master handling data would be like making your team lead personally deliver every piece of mail: technically possible, immediately catastrophic.
The actual write flow, derived from the GFS paper (Ghemawat, Gobioff, and Leung, SOSP 2003):
- Client asks the master: "Which chunk servers hold chunk X? Who is the primary?"
- Master grants a lease to one replica, making it the primary. Lease duration: 60 seconds, renewable.
- Master returns the primary and secondary locations to the client. Client caches this.
- Client pushes raw data to all replicas via a pipeline: chunk server A to B to C, each forwarding to the nearest neighbor as data arrives. This is data flow.
- Once all replicas have buffered the data, client sends a write request to the primary only. This is control flow.
- Primary assigns a serial number to this mutation and applies it. Forwards the write request (with the serial number) to secondaries.
- Secondaries apply the mutation in the same serial order and acknowledge back to the primary.
- Primary replies to the client: success or error.
Separating data flow from control flow is the whole trick. Data travels along a chain of chunk servers chosen for network proximity, maximizing pipeline bandwidth. The control signal is tiny and just coordinates ordering. The master is involved only in step 1. Everything else bypasses it.
If a write succeeds at the primary but fails on one or more secondaries, the client receives an error and retries. Failed replicas may be left with stale data; the master will eventually detect under-replication and re-replicate.
Orange: data pipeline, routed by proximity. Blue dashed: control signals, tiny and primary-only. The master sits out after step 1.
The Read Path Is Simpler
- Client asks master: "Where are the replicas for file F, bytes [0, N]?"
- Master returns chunk handles and replica locations. Client caches.
- Client picks the nearest replica (typically by network proximity) and reads directly.
The master is consulted once. After that, the client's cache handles subsequent reads to the same chunk. Checksums run on every read, not just when something looks wrong. A CRC32 mismatch means corruption; the client reads from another replica and reports the corrupted block to the master, which triggers re-replication.
When Nodes Die: How the Cluster Responds
Heartbeats. Each chunk server sends a heartbeat to the master every 3 seconds along with a block report listing the chunks it holds. No heartbeat for 10 minutes and the server is officially declared dead. The dead server doesn't get a vote in this. The master immediately identifies every under-replicated chunk it was hosting and schedules re-replication to healthy servers.
Replication with rack awareness. The default is 3 replicas. Placement rule: first replica on the local node, second on a node in a different rack, third on another node in that same second rack. This survives single-node failures and single-rack failures (switch dies, power strip trips). You get cross-rack redundancy without the bandwidth cost of putting every replica on a separate rack.
Checksums. Every 64 KB sub-block stores a CRC32 checksum. Checksums are verified on every read, not just on suspicion. Silent data corruption is caught before it propagates.
Node X goes dark. The master schedules Node D in Rack 2 to receive a new copy. The cluster heals itself without a human on-call ticket.
Three Bottlenecks You Will Hit
1. Metadata server memory. At sufficient scale, chunk metadata outgrows RAM on any single machine. Mitigations: larger chunk size (fewer chunks for the same data), compressing metadata, and eventually distributing metadata across a key-value store.
2. The master as hot spot for metadata operations. Every file open, every namespace traversal goes through the master. GFS handles this partly by caching: clients cache chunk locations, so repeated reads to the same chunks don't hit the master at all. Namespace operations use fine-grained read-write locks per directory, so parallel operations on different directories don't serialize.
3. Write amplification with 3x replication. Writing 1 byte physically writes 3 bytes across the cluster. For a workload generating 1 TB/day, you're actually writing 3 TB/day. Reed-Solomon erasure coding (6 data + 3 parity chunks) reduces this to 1.5x overhead at the cost of more CPU for encoding and slower recovery when a node fails. HDFS introduced erasure coding in version 3.0 for cold data where recovery speed matters less than storage efficiency.
Two Tradeoffs to Name Explicitly
Replication vs. erasure coding. 3x replication gives fast failure recovery (just copy a block from a healthy replica) and fast reads (pick the nearest copy). Erasure coding saves roughly 50% storage cost but requires reading from multiple nodes and computing parity to reconstruct a lost block. The practical split: replication for hot data, erasure coding for cold archives.
Strong vs. eventual consistency. GFS's model is relaxed: after concurrent writes, a region is "consistent" (all replicas agree) but may be "undefined" (clients can't predict what they'll read if multiple writers were active). For serial appends, GFS guarantees "defined" regions where the appended data is visible exactly as written. If your workload requires multiple writers to a shared file with predictable read semantics, you need a different system (or a locking layer on top). Most distributed file systems designed for throughput accept undefined behavior on concurrent writes because locking across replicas kills performance.
How to Navigate 45 Minutes
Spend your time roughly like this:
| Phase | Minutes | Deliverable |
|---|---|---|
| Requirements + numbers | 5 | Written scope, 3-4 scale estimates |
| High-level architecture | 5 | Three-tier diagram with arrows |
| Core flows (write path, read path) | 10 | Write flow numbered, read flow noted |
| Fault tolerance | 7 | Heartbeat, replication, checksums |
| Scalability + bottlenecks | 8 | Metadata limit, write amplification |
| Tradeoffs + deeper dives | 10 | Replication vs EC, consistency model |
If the interviewer asks about a specific area early, go there. Don't rigidly follow the script. But if they go quiet, use this order: it surfaces the most interesting parts (the write path, the consistency model) before time runs out.
The failure mode candidates most often hit: spending 25 minutes on the high-level architecture and running out of time before discussing fault tolerance or tradeoffs. Say the write path correctly (lease, data chain, control separately) and name the consistency model correctly (defined vs. undefined). These two topics separate candidates at the top.
What to Get Right
- Three tiers: master (metadata only, in memory), chunk servers (data, on disk), clients (cache metadata).
- Chunks are large (64-128 MB) to reduce metadata size.
- Write flow: data pushed via pipeline to all replicas (data flow), then control signal to primary, primary serializes and forwards (control flow), secondaries ack.
- Rack-aware 3x replication protects against node and rack failures.
- Heartbeats every 3 seconds; no heartbeat for 10 minutes means re-replication.
- CRC32 on every read for silent corruption detection.
- Metadata memory limit is the primary scaling wall. Solution: distribute metadata into an external key-value store.
- Replication for hot data, erasure coding for cold.
- Relaxed consistency: serial writes are defined, concurrent writes are undefined.
Practicing how to communicate all of this under interview pressure is its own skill. SpaceComplexity runs voice-based system design mock interviews where you get rubric feedback on how you scope, structure, and explain tradeoffs. The gap between knowing the right answer and saying it clearly under time pressure is where most candidates lose offers. Worth closing before the real interview.
For deeper background on the data structures and algorithms underlying these systems, see Bloom filters (used for SSTable cache miss avoidance in storage stacks built on LSM trees), skip lists (the data structure backing Redis sorted sets and LevelDB memtables), and the tradeoff maze for a sharper look at how to frame push vs. pull architectural decisions.
Further Reading
- The Google File System (Ghemawat, Gobioff, Leung, SOSP 2003) (original paper; sections 3 and 4 cover the write flow and consistency model)
- GFS vs. Hadoop Distributed File System (HDFS) on GeeksforGeeks (side-by-side comparison of the two canonical implementations)
- Design Principles of Distributed File Systems on GeeksforGeeks (concise overview of the core principles)
- Distributed file system for cloud on Wikipedia (taxonomy of cloud-era variants)
- A Peek Behind Colossus, Google's File System on Google Cloud Blog (what came after GFS and why)