Highlights

Contents

Part VIII
08

Case study: the media upload path

We now trace the clip from permission through transfer, verification, storage, and playback. Each state has a specific owner and a recovery rule. We will reconcile the byte budget, follow interrupted completion, and explain what every component contributes.

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 29A complete upload trace

The uploader asks Heron to reserve clip c7. The app authenticates ownership, checks policy, creates pending metadata, and chooses an immutable source identity. It returns scoped upload access, while the client sends 50 illustrative parts directly to storage for the 5,000,000,000-byte clip.

After completion, the app verifies the reserved length and checksum scope. Conversion workers read the exact immutable source, use temporary local storage, and create derived immutable outputs. Publication atomically changes the database’s active clip state and output pointer. The object service never decides match ownership on the application’s behalf.

THE APP RESERVES AND PUBLISHES; STORAGE HOLDS THE BYTES IN BETWEENTHE APP RESERVES AND PUBLISHES; STORAGE HOLDS THE BYTES IN BETWEENreserve + authorizeappdirect multipart transferclient → storageverify + processapp + workerspublish metadataone DB commiteach arrow crosses a separate failure and ownership boundary
Figure 13.32End-to-end upload. Each arrow crosses a separate failure and ownership boundary.
FOUR COMPONENTS, FOUR JOBS IN THE MEDIA PATHFOUR COMPONENTS, FOUR JOBS IN THE MEDIA PATHapplicationpermission + upload statedatabaserelationships + publicationobject serviceimmutable bytes + attributesworkerverify and derive outputsa CDN delivers after publication, under its own cache and access rules
Figure 13.33Architecture summary. CDN delivery follows publication and keeps its own cache and access rules.

A viewer receives playback access only after the database permits it. That access may point through a CDN rather than directly to origin storage. The next chapter examines whether cached bytes are fresh and authorized, and how edge and origin behavior changes the load model.

#Section 30Interrupted completion and idempotent recovery

The client completed multipart transfer, but its final response was lost. A retry asks about the same upload identity. The app verifies the exact completed object, advances the existing state if needed, and returns the already-known result. It does not create a new object because the previous reply was absent.

A conversion message can also be delivered again. The worker uses a processing identity tied to source version and output recipe. It can recover existing verified outputs and complete publication once. It must not accept an output from a different source merely because a familiar key exists.

THE COMPLETION REPLY WAS LOST; RETRYING "COMPLETE c7" RETURNS THE SAME VERIFIED STATETHE COMPLETION REPLY WAS LOST; RETRYING "COMPLETE c7" RETURNS THE SAME VERIFIED STATEclientapplicationc7/source-v1complete c7already verifiedc7
Figure 13.34Idempotent completion trace. Storage evidence and application state refer to the same immutable identity.

Cleanup must coordinate with this recovery horizon. Expiring the reservation before supported retries end can make the app misclassify legitimate completed bytes as abandoned. Retaining it indefinitely wastes state. The contract chooses a bounded horizon and the numeric and failure tests verify behavior around its endpoints.

#Section 31Reconcile all byte budgets

The shared illustrative database write model is 8,640,000 records per day at 500 bytes, giving 4,320,000,000 bytes daily. Thirty days gives 129,600,000,000, and three full copies give 388,800,000,000. This is a database workload, not the separate 100-clips-per-day media assumption.

The shared event workload is 20 events per second at 200 bytes, giving 345,600,000 bytes per day. Thirty days gives 10,368,000,000 before replicas and indexes. A live fan-out copy delivered to every viewer should not be counted as a separate retained original unless the system actually stores each delivery.

RECORDS AND EVENTS ARE DIFFERENT MODELS: 388.8 GB OF RECORDS VS 10.368 GB OF EVENTSRECORDS AND EVENTS ARE DIFFERENT MODELS: 388.8 GB OF RECORDS VS 10.368 GB OF EVENTSrecords/day8,640,000 × 500 Brecords, 30 daysbefore copies× 3 copies388,800,000,000 Bevents, 30 days20 × 200 × 2,592,000retain originals; fan-out deliveries are transmitted, not stored
Figure 13.35Computed shared Heron assumptions. Media storage is a separate explicitly illustrative extension.
ONE 5 GB UPLOAD: 15 GB AS 3 COPIES, OR 7.5 GB AS 4 + 2 CODING; NEVER BOTHONE 5 GB UPLOAD: 15 GB AS 3 COPIES, OR 7.5 GB AS 4 + 2 CODING; NEVER BOTHlogical5 GB · 50 parts3 full copies15 GB · replication model4 + 2 erasure coding7.5 GB · coding modelapp-proxied traffic10 GB · in + outcompare alternatives; do not add mutually exclusive designs together
Figure 13.36Alternative illustrative physical and traffic budgets. Do not add mutually exclusive redundancy models together.

Capacity tests need request rate, object size distribution, transfer bandwidth, incomplete-upload population, verification work, conversion cost, and repair traffic. A storage total alone cannot predict upload time, and a fast link alone cannot establish durable publication.

#Section 32The interview design and its boundary

At the whiteboard, draw metadata through the app to the database and file bytes directly to object storage. Then annotate the upload-state machine, scoped access, checksum verification, multipart session, and immutable publication pointer. Show how each crash is recovered under the same identity.

Compare a local disk, a block volume, a shared file service, and an object API by their operations and failure contract. Explain how replicas or coding keep data available, how lifecycle affects retrieval, and how backups and independent metadata recovery support disaster restoration. None of these labels alone promises a cross-service transaction.

FOUR BOUNDARIES, FOUR QUESTIONS, FOUR KINDS OF EVIDENCEFOUR BOUNDARIES, FOUR QUESTIONS, FOUR KINDS OF EVIDENCEpermissionwho may upload?trusted reservationtransfersame intended bytes?length + checksumpublicationplayable now?verified staterecoverysurvives a fault?copies + restore test
Figure 13.37Complete design checklist expressed as mechanism boundaries. Evidence must refer to the exact object and operation.

This chapter has not designed a production distributed filesystem or promised current storage prices and capacities. It has supplied the mechanisms needed to evaluate one and to build a media path without routing every byte through the app. The next boundary is content delivery, where cached bytes introduce another freshness, identity, and permission layer.