Part 7 · Blueprint 41
Distributed File Systems (GFS / HDFS / Colossus Architecture)
12 min reading · Sources · Editorial review pending
A metadata answer can outlive the chunk generation it described.
Page details
Published date · Last edited:
Draft edition. Editorial review and supplementary reading recommendations are still being completed.
Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: Database Sharding & Consistent Hashing, Replication, Consensus & Automated Failover, Distributed Blob & Object Storage (Amazon S3 Scale).
Sixty-second mental model
Problem: A metadata answer can outlive the chunk generation it described.
Use: Use generation-aware chunk access and deliberate replica placement.
Design boundary: Implement a file namespace over replicated blocks with explicit writer ownership and lease recovery. File mutation and object publication have different access contracts.
Layer 1 · Intuition
Hypothetical scenario: Northwind is designing distributed file systems. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one chunk means and which component owns the file-to-chunk mapping.
Think of a directory office directing clients to large data chunks. Separate the requester from file-to-chunk mapping, then identify the retained evidence needed after failure.
- Authority
- The entitled state owner.
- Invariant
- A rule preserved across concurrency and failures.
- File storage
- A storage interface exposing files, directories and associated operations. Analogy: A filing cabinet organized into folders.
Architecture and worked reasoning
Design boundary: Implement a file namespace over replicated blocks with explicit writer ownership and lease recovery. File mutation and object publication have different access contracts.
Responsibilities on the request path
Workload and limiting resource
Hypothetical 1 GiB file with 128 MiB blocks uses eight blocks. Three full replicas use 3 GiB of raw file bytes before checksums/metadata. A 1,000,000-file namespace can strain metadata independently of total byte volume if files are tiny.
Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.
Mutation or publication path
- Create a file/writer lease.
- Allocate blocks and stream through the chosen replica pipeline.
- Commit length/block visibility according to the file protocol.
Observation and recovery path
- Resolve a pathname and block locations.
- Read verified bytes directly from eligible data nodes.
- Refresh locations or recover from another replica after failure.
Failure that changes the decision
Hypothetical scenario: A previous writer resumes after lease recovery. Block/version generation rules must reject stale appends.
Attempt this decision before reading the explanation
Does the namespace server need to proxy every file byte?
Not necessarily. Separating metadata lookup from data transfer reduces namespace bandwidth, but clients need verified locations and defined recovery when those locations change.
Supporting mechanism analysis
Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.
That skips the metadata and readiness contract. A reader needs an eligible reference to the verified version, not merely evidence that some bytes arrived.
An object store manages byte sequences identified by object keys within its namespace. Metadata records describe which object belongs to a product, which version is current and whether that object is ready for readers. The catalogue can return a small object reference without transporting the object through every database query and application response.
The boundary is not absolute: databases can store large values, and object stores can retain metadata. Choose the arrangement for the access and lifecycle needs. Here, separate product queries, image transfer and publication state make the responsibilities easier to explain and operate.
Do not mark the image ready merely because a client reports that it finished sending. The publication path needs evidence that the expected object exists and satisfies the chosen checks. Depending on the feature, checks may include expected size, integrity, media type and necessary content processing. State the actual acceptance rule rather than claiming that an object-store response proves every application property.
An orphan collector and a publisher can race. A collector cannot safely delete an apparently unreferenced object if a valid pending intent may still publish it. Protect publication eligibility and collection through a lifecycle rule: expire or claim the intent under the same authority that admits publication, then delete only after its retained-reference checks pass. The exact conditional operation must be implementable in the selected metadata store.
Use an immutable object identity for a published version where the lifecycle supports it. A visitor requesting that identity should receive the bytes associated with that version, rather than whichever upload most recently reused a mutable name. The metadata pointer can change to a new version without making the old identity ambiguous.
The selected object-to-metadata ratio is 2,000,000 ÷ 500 = 4,000. That ratio explains why making catalogue selection transport the object bytes would change the work dramatically. It is not a claim that every real image or metadata record has either selected size.
An intent can exist without completed bytes. Bytes can exist while verification or publication is pending. A ready reference can exist while an object becomes unavailable. These states are possible precisely because publication crosses independently operated boundaries. Treat them as part of the workflow, not anomalies a two-store diagram somehow prevents.
Cleanup must not race with legitimate work. Before deleting an apparently orphaned object, account for pending intents, publication attempts and the selected retention policy. A recently unreferenced object may still be needed by in-flight readers or an allowed rollback. An arbitrary timer does not establish that deletion is safe.
Likewise, a successful object retrieval does not establish that the product is currently eligible to display it. Public catalogue images are the selected scope here. A future private attachment feature would require authorization at the relevant retrieval boundary rather than assuming that knowledge of an object address is sufficient permission.
Separate objects from metadata when byte transfer, serving, retention and processing have materially different needs from record selection. Keep simpler storage where objects are small and the extra coordination adds little value. The decision should follow the feature’s lifecycle and operating constraints, not a rule that all files must use one storage pattern.
Layer 3 · Internals
HDFS distinguishes a NameNode's namespace and block-location responsibilities from DataNode byte transfer. A reader first resolves the file's blocks, then contacts a suitable DataNode. A writer can pipeline replicas through DataNodes rather than making the metadata node relay every byte. This division keeps metadata operations and bulk bandwidth as separate capacity problems.
Large blocks reduce the number of metadata entries for large sequential files, but do not make small random updates free. Block reports, checksums, generation information and recovery protocols matter when replicas disagree or nodes disappear. Rack-aware placement attempts to keep a local failure from removing every usable copy, subject to the configured policy. A directory listing or healthy NameNode does not prove every referenced block is available. State the intended workload: bulk sequential processing and a low-latency transactional record store have different requirements. Metadata high availability also needs a protocol; a second machine holding an old namespace is not automatically a safe replacement authority.
Trade-offs and limits
| Approach | Provides | Requires |
|---|---|---|
| Large replicated chunks | Fits bulk sequential access and makes placement explicit. | Small-file metadata and partial updates need separate treatment. |
| Object-style immutable versions | Simplifies versioned publication and caching. | File-system mutation semantics must be implemented elsewhere if required. |
Recovery decision
Hypothetical scenario: A previous writer resumes after lease recovery. Block/version generation rules must reject stale appends.
Not necessarily. Separating metadata lookup from data transfer reduces namespace bandwidth, but clients need verified locations and defined recovery when those locations change.
Write your design before revealing the review
Does the namespace server need to proxy every file byte?
Drafts and self-review are stored only in this browser. They are separate from reading completion.
Compare your decision
Not necessarily. Separating metadata lookup from data transfer reduces namespace bandwidth, but clients need verified locations and defined recovery when those locations change.
A previous writer resumes after lease recovery. Block/version generation rules must reject stale appends.
Check your understanding
Does the namespace server need to proxy every file byte?
Not necessarily. Separating metadata lookup from data transfer reduces namespace bandwidth, but clients need verified locations and defined recovery when those locations change.
How would you recover from this failure: A previous writer resumes after lease recovery. Block/version generation rules must reject stale appends.
Start with the exact boundary that failed. Create a file/writer lease. Allocate blocks and stream through the chosen replica pipeline. Commit length/block visibility according to the file protocol. Then recover evidence through the observation path: Resolve a pathname and block locations. Read verified bytes directly from eligible data nodes. Refresh locations or recover from another replica after failure. Preserve the distinction between a confirmed state change and an unavailable response.
Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?
Hypothetical 1 GiB file with 128 MiB blocks uses eight blocks. Three full replicas use 3 GiB of raw file bytes before checksums/metadata. A 1,000,000-file namespace can strain metadata independently of total byte volume if files are tiny. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Implement a file namespace over replicated blocks with explicit writer ownership and lease recovery. File mutation and object publication have different access contracts.
Which component in this topology could be removed from a smaller first deployment?
Namespace owner, Block map, Data nodes, Lease recovery name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Create a file/writer lease.
What evidence must a caller have before relying on the observation path?
Resolve a pathname and block locations. Read verified bytes directly from eligible data nodes. Refresh locations or recover from another replica after failure. Not necessarily. Separating metadata lookup from data transfer reduces namespace bandwidth, but clients need verified locations and defined recovery when those locations change.
45-minute interview rubric
- 00–05: scope chunk and file-to-chunk mapping.
- 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
- 12–28: draw file-to-chunk mapping, numbered writes and reads.
- 28–40: challenge recovery: Use generation-aware chunk access and deliberate replica placement.
- 40–45: defend file_id placement, observations and remaining assumptions.
Go deeper
- Apache Hadoop 3.5.0 – HDFS Architecture · Primary document · hadoop.apache.org. Use generation-aware chunk access and deliberate replica placement. Verified 2026-10-26.
- What is Amazon S3? - Amazon Simple Storage Service · Primary document · docs.aws.amazon.com. Use generation-aware chunk access and deliberate replica placement. Verified 2026-10-26.
Decision log
Use generation-aware chunk access and deliberate replica placement.
Preserve chunk identity and file-to-chunk mapping ownership.
Revisit changed workload, observations or recovery objectives.