Highlights

Contents

SYSTEM DESIGN / UNIT 13 / FIELD GUIDEStoragesystemsStorage systemskeybytesmetakeybytesmetakeybytesmetaBytes need an address and a lifetimeBlocks, file paths and immutable object identitiesRead the mechanism. Follow its state.Test what happens when the path breaks.MECHANISMS, TRACES AND INTERVIEW PRACTICE
Before we start

How to read this chapter

Local, block, file, object, database, and distributed storage, followed through a verified direct multipart upload and its recovery. Design the metadata and media paths, count their bytes, and explain every publication and recovery boundary.

Read each small topic as a separate whiteboard explanation. Start with the concrete failure, follow the mechanism, and check the worked example before looking at the picture. A paragraph introduces one idea; the next picture shows the state or message that changes. You should be able to redraw it and say where it can fail.

The orange map marks the part you are reading. Picture this boxes give a physical analogy, notes explain a useful variant, warnings name a mistake, and interview boxes give an answer you can say aloud. Each part closes with In one breath. The interview page has questions, graded exercises, and worked answers; use it after reading, with the diagrams hidden.

These are design lessons, not measured capacity claims. All Heron workloads, durations, limits, and record sizes are illustrative assumptions. The arithmetic lives in scripts/system-design/numbers.py and scripts/system-design/storage-numbers.py; real product behavior is linked to its primary documentation. A decimal MB is a million bytes; a GiB is a power-of-two unit. Capacity still needs a load test on your workload.

The running system

Meet Heron

Heron is an illustrative live-score and media service. A scorer changes a match, viewers read its score, subscribers receive updates, and users upload clips. We keep the workload fixed across the series so a faster path, a replica, or a cache changes the same calculation instead of quietly changing the question.

Assumed setting Symbol Value What it controls
Daily API requests DD 8,640,000 Baseline request demand
Peak multiplier pp 10 Peak relative to daily average
Mean response time at peak WW 0.2 s Mean in-flight work
API response size bb 2,000 bytes Payload bandwidth
Stored record size rr 500 bytes An illustrative write workload
Record retention tt 30 days Storage calculation
Live events ee 20 per second Fan-out input
Live viewers vv 50,000 Fan-out recipients
Event payload mm 200 bytes Live payload bandwidth
Gateway capacity assumption gg 10,000 connections A sizing exercise, not a benchmark
Replication factor NN 3 Copies of a logical record
Rate policy LL 100 requests per user per minute Admission rule

The computed baseline is 100 requests per second on average and 1,000 at peak. At the assumed mean latency, 200 requests are in flight. Live fan-out is 1,000,000 deliveries per second, carrying 200,000,000 payload bytes per second before protocol overhead. These are different workloads; never size the live path using the API request rate.

This unit adds an explicitly illustrative media population of 100 clips per day, each 5,000,000,000 decimal bytes, to demonstrate lifecycle accounting. Its 100,000,000-byte multipart size and 10,000,000-byte-per-second direct link are assumptions, not service limits or benchmarks. Database records and live event originals remain separate shared Heron workloads.

The map

What is inside

Design the metadata and media paths, count their bytes, and explain every publication and recovery boundary.

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
  1. 01Local, block, file, object storageSections 1 to 4. We decide what operations the application needs before choosing where bytes live.
  2. 02Buckets, objects and metadataSections 5 to 8. We give media bytes stable identities and keep application facts where they can be queried safely.
  3. 03Presigned URLs and direct uploadSections 9 to 12. We move large bytes directly between the client and storage while the application controls permission.
  4. 04Multipart uploadsSections 13 to 16. We split a large transfer into independently recoverable parts without exposing a partial object as finished.
  5. 05Checksums and integritySections 17 to 20. We detect changed bytes and distinguish integrity from ownership and content safety.
  6. 06Replication and distributed file systemsSections 21 to 24. We keep bytes available across machines without assuming every copy is fresh or safe.
  7. 07Lifecycle and retentionSections 25 to 28. We decide how long source bytes, derived bytes, versions, and unfinished transfers remain.
  8. 08Case study: the media upload pathSections 29 to 32. We now trace the clip from permission through transfer, verification, storage, and playback.
  9. +Interview prepInterview question bank, graded exercises and worked solutions.