Highlights

Contents

Part VI
06

Replication and distributed file systems

We keep bytes available across machines without assuming every copy is fresh or safe. Replication, erasure coding, and distributed filesystems move failure ownership into another service. We will calculate physical bytes, examine repair, separate data from metadata coordination, and trace cross-region recovery.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Local, block, file,object storage2Buckets, objects andmetadata3Presigned URLs and directupload4Multipart uploads5Checksums and integrity6Replication anddistributed file systems7Lifecycle and retention8Case study: the mediaupload path

#Section 21Replication multiplies physical storage

A single local media copy disappears with its only disk. Replication keeps multiple copies of the same logical data so surviving copies can serve or restore it under the chosen failure model. Copies need placement, update, integrity, and repair policies; the count alone supplies none of these.

For Heron’s illustrative 5,000,000,000-byte object and three complete copies, payload storage is 15,000,000,000 bytes. This excludes object metadata, coding, snapshots, and temporary transfer storage. If all copies share a rack or credential that can delete them, that common cause can defeat the logical redundancy.

THREE FULL COPIES OF 5 GB = 15 GB, AND ONLY USEFUL IN SEPARATE FAILURE DOMAINSTHREE FULL COPIES OF 5 GB = 15 GB, AND ONLY USEFUL IN SEPARATE FAILURE DOMAINS5 GB logicalzone A5 GBzone B5 GBzone C5 GB15,000,000,000 B before metadata, snapshots and transfer copies
Figure 13.23Decimal GB in an illustrative full-copy model. Actual service placement and coding are product-specific.

Replica acknowledgement determines which copies must have the data before the caller hears success. An asynchronous remote copy can still be absent after local acknowledgement. A synchronously required remote copy can add delay or reduce write availability during its failure. Choose the guarantee, then trace acknowledgement and recovery.

#Section 22Erasure coding trades repair for space

A large immutable object can be split into data pieces with parity information. Erasure coding stores enough derived pieces to reconstruct data after a stated number of missing pieces, according to the code and placement. It can use less storage than full replication while changing read and repair behavior.

In an illustrative systematic four-data, two-parity model, each shard holds 1,250,000,000 bytes for the 5,000,000,000-byte object. Six shards total 7,500,000,000 bytes, a factor of 1.5 of logical payload. An appropriate code can reconstruct from any four available shards, tolerating two missing shards under this model.

FOUR DATA SHARDS AND TWO PARITY SHARDS CHANGE THE STORAGE BUDGETFOUR DATA SHARDS AND TWO PARITY SHARDS CHANGE THE STORAGE BUDGETD1dataD2dataD3dataD4dataP1parityP2parity5,000,000,000 B ÷ 4 = 1,250,000,000 B per shard6 × 1,250,000,000 B = 7,500,000,000 B stored
Figure 13.24Illustrative erasure-code model, not a claim about a chosen storage provider’s internal layout.

Repair may need several surviving pieces and network reconstruction work rather than copying one intact replica. Small random reads and updates can incur different costs from sequential immutable reads. Do not assume erasure coding is automatically the best choice for a latency-sensitive database page workload.

#Section 23Distributed file systems coordinate names and pieces

A large dataset no longer fits or survives on one host. A distributed file system coordinates a file namespace and storage pieces across machines. It must locate data, maintain authoritative metadata, detect failures, and repair or replicate pieces according to its semantics.

The Google File System paper describes a concrete design shaped by its workloads rather than a universal filesystem contract. It separates metadata coordination from data transfer to chunk servers and treats component failure as expected. The lesson is to explain where file metadata and payload ownership live, not to copy its policies into every application.

THE COORDINATOR KNOWS WHERE PIECES LIVE; DATA SERVERS MOVE THE BYTESTHE COORDINATOR KNOWS WHERE PIECES LIVE; DATA SERVERS MOVE THE BYTESmetadata coordinatorc7 → s2, s4, s5s1s2s3s4s5clientwhere?bytes direct
Figure 13.25Distributed-filesystem architecture concept. Guarantees vary by implementation and protocol.

A coordinator outage can affect opening or changing files even when data servers still hold their pieces. Cached locations may permit limited continued reads but need version and lease rules. Heron’s object-service choice similarly delegates a distributed storage implementation, yet the app still owns its database-to-object relationship and permissions.

#Section 24Cross-region copies and recoverable state

Heron needs media after losing the active region. A remote copy must include the intended immutable object and enough metadata to find and authorize it. Replicating bytes without the active clip pointer can leave an unusable library; replicating pointers ahead of bytes can expose missing media.

An illustrative score-log replication gap of 5 seconds at 20 events per second represents 100 events. The same principle applies to object replication, but large objects and completion events have different transfer time and ordering. Measure which acknowledged objects exist at the recovery destination rather than converting an unrelated row lag into media safety.

TO RECOVER IN REGION B YOU NEED THE OBJECT COPY AND ITS VERIFIED POINTERTO RECOVER IN REGION B YOU NEED THE OBJECT COPY AND ITS VERIFIED POINTERregion Ac7 v2region Bc7 v2publish only when bothare present and match
Figure 13.26Cross-region recovery concept. Byte and metadata replication must be reconciled by identity and state.
A 5 S GAP IS 100 SCORE EVENTS, BUT A 5 GB CLIP REPLICATES ON ITS OWN CLOCKA 5 S GAP IS 100 SCORE EVENTS, BUT A 5 GB CLIP REPLICATES ON ITS OWN CLOCK20 events/s × 5 s = 100one 5 GB clipcopy progress, measured per objectdo not reuse a lag number across different workloads
Figure 13.27Illustrative score-gap arithmetic. It cannot substitute for object-copy evidence.