FullStack AI Hub
Studio
System Design · 03. Data & Storage
9 min
10 steps
Beginner

Object & Blob Storage

Store petabytes of user media durably using presigned URLs, multipart uploads, erasure coding, and lifecycle tiers.

System Design03. Data & StorageLesson 9 of 11
9 minBeginner10 steps

Object & Blob Storage

Store petabytes of user media durably using presigned URLs, multipart uploads, erasure coding, and lifecycle tiers.

API RAM USED
96% (OOM!)
DOUBLE BANDWIDTH
2× cost
API P95
1,400 ms
SQL BACKUP SIZE
4.2 TB bloated
50MB streamINSERT BYTEA50MB videosAPI Fleet(OOM!)96%buffering 10GBSQL BYTEA Blobs92%4.2 TB bloated
presigned auth / metadata
direct media upload
CDN / fast read
proxied 50MB bloat
API OOM / drop
In This LessonStep 1 of 10
What You Will Master
  • ✓Bypass application servers completely for media uploads and downloads using short-lived Presigned URLs
  • ✓Make large video uploads resumable with Multipart Uploads and content-addressed immutable object keys
  • ✓Achieve 11 nines (99.999999999%) durability at half the storage cost of 3× replication using Erasure Coding
  • ✓Pair Edge CDNs with automated Hot → Infrequent → Archive lifecycle tiering to slash petabyte bills

Architectural Trade-Off Comparison Matrix

PatternBest ForKey Trade-Off
Presigned URLs (Direct-to-S3)User avatar, photo, and video uploads/downloads without burning API server RAM or bandwidthRequires short expirations (e.g., 5 min), strict MIME/size policies, and async upload-complete webhooks
Multipart Chunked UploadFiles >5–10 MB over flaky mobile links—uploads 5 MB parts in parallel and retries only failed chunksMust run lifecycle rules to abort incomplete multipart fragments after 24 hours
Reed-Solomon Erasure Coding (e.g., 10+4)Petabyte-scale durability (11 nines) using only 1.4× storage overhead instead of 3× raw copiesSlightly higher CPU to compute parity shards during writes and rebuild failed disks
Automated Storage Lifecycle TiersTransitioning older media automatically from Standard → Infrequent Access → Glacier Cold ArchiveCold archive retrievals incur minutes-to-hours restore delay and per-GB retrieval fees

Step-by-Step Architectural Breakdown (10 Steps)

Full architectural walkthrough transcript and state transitions for Object & Blob Storage.

STEP 01 · PROBLEMJump to step →

The rookie mistake: proxying 50 MB videos through your API

Your users start uploading 50 MB videos via `POST /api/upload`. Your Node/Go **App Servers** buffer each upload in RAM, double your cloud egress bill, and then store the bytes as a giant `BYTEA` blob inside PostgreSQL.

At just **200 concurrent uploads**, app servers consume **10 GB of RAM**, choke worker threads, OOM-crash, and bloat PostgreSQL backups to terabytes.

watch:Never store large media blobs in PostgreSQL—and never stream multi-megabyte files through your web API servers when clients can talk directly to Object Storage.

API Bandwidth BottleneckSQL Blob BloatMemory Exhaustion
STEP 02 · SOLUTIONJump to step →

The fix: Direct-to-S3 uploads with Presigned URLs

Decouple the **Control Plane** (auth + metadata) from the **Data Plane** (heavy bytes). First, the phone sends a tiny 200-byte request to your API (`POST /uploads/init`).

Your API validates auth and returns a **cryptographically signed Presigned URL** (valid for 5 minutes, locked to `max 50 MB, image/mp4`). The phone uploads all 50 MB **directly into Object Storage (S3/GCS)**—zero bytes touch your API!

idea:Presigned URLs keep your API servers razor-light (200-byte JSON) while outsourcing petabyte-scale TLS streaming directly to S3/GCS.

Presigned URLsControl vs Data PlaneScoped Upload Policies
STEP 03 · TECHNIQUEJump to step →

Multipart Uploads: parallel & resumable over flaky mobile links

If a phone uploads a 200 MB video as one HTTP `PUT` and hits a tunnel at 94%, the entire 188 MB upload **starts over from 0%**.

**Multipart Upload** splits the file into **5 MB numbered chunks**, uploads 4 chunks in parallel over separate connections, and retries **only the single dropped chunk**—then S3 stitches the parts atomically with one `CompleteMultipartUpload` call.

idea:Always attach a 24-hour bucket lifecycle rule (`AbortIncompleteMultipartUpload`) so abandoned half-uploaded chunks don’t silently rack up storage bills.

Multipart UploadsChunk-Level RetryIncomplete Part Cleanup
STEP 04 · TECHNIQUEJump to step →

Flat Namespace & Content-Addressed Immutable Keys

Object storage is NOT a POSIX folder filesystem—it is a **flat key-value store** (`bucket + key → immutable bytes + metadata`). Slashes like `media/2026/a9f3.webp` are just string characters.

Name objects with a **random prefix or SHA-256 content hash** (`9f3a/avatar_9f3a81.webp`). Immutable hashed keys enable automatic deduplication, distribute load evenly across S3 key partitions, and make CDN caching trivial forever.

idea:Never overwrite `/avatars/user_42.jpg` in place—write a brand-new immutable key `/avatars/9f3a81.jpg` and swap the pointer in SQL for instant cache invalidation.

Flat KeyspaceContent Addressing (SHA-256)Immutable Objects
STEP 05 · SOLUTIONJump to step →

11 Nines of Durability at Half the Cost: Erasure Coding

Storing 3 full copies (`3× replication`) of 10 Petabytes costs **30 PB of raw disks** and only survives 2 simultaneous disk failures.

Cloud Object Stores use **Reed-Solomon Erasure Coding (e.g., `10 data + 4 parity`)**: split each object into 10 chunks, compute 4 math parity chunks, and spread all 14 across separate racks/AZs. You survive **any 4 simultaneous failures** (`99.999999999%` durability) at just **1.4× storage overhead**!

idea:Erasure Coding (10+4) beats 3× Replication on BOTH axes: higher fault tolerance (4 failures vs 2) AND 53% lower raw disk cost (1.4× vs 3.0×).

Reed-Solomon Erasure Coding11 Nines DurabilityParity Reconstruction
STEP 06 · TECHNIQUEJump to step →

Event-Driven Media Pipeline: S3 Event → Queue → Transcoders

Never resize images or transcode 4K videos synchronously inside a user upload request! Once the direct S3 upload finishes, Object Storage emits an **`ObjectCreated` event** into a message queue.

Stateless worker pods pull jobs asynchronously to scan for malware, generate WebP thumbnails and HLS video renditions, write derivatives back to S3, and flip `status = "ready"` in SQL.

idea:S3 → Queue → Worker decouples upload latency (instant UX) from heavy CPU/GPU transcoding and naturally absorbs viral upload bursts.

S3 Event NotificationsAsync TranscodingDerivative Objects
STEP 07 · SOLUTIONJump to step →

Serving Media Globally: Private S3 + Signed CDN Edge

Serving viral photos straight out of S3 pays expensive cloud egress fees (`$0.09/GB`) and suffers cross-continent latency. Instead, keep the S3 bucket **100% Private (OAC)** and front it with a **Global CDN**.

For public assets, immutable hashed URLs hit the CDN edge at **96% hit rate** in 18 ms. For paid/private docs, the CDN verifies **Signed Cookies or Signed URLs** right at the edge before serving cached bytes!

idea:Never make production S3 buckets public—use Origin Access Control (OAC) so only your CDN can read S3, slashing egress costs by 80%+.

Origin Access Control (OAC)Signed CDN CookiesEgress Cost Reduction
STEP 08 · TECHNIQUEJump to step →

Lifecycle Tiering: cut petabyte storage bills by 80%

90% of uploaded videos and audit logs are viewed heavily in their **first 30 days**, rarely between **30–90 days**, and almost never after **90 days**—yet keeping everything in Standard Hot tier bills `$23/TB/month` forever.

Attach automated **Lifecycle Policies**: `0–30d` in **Standard Hot** (`$23/TB`), `30–90d` auto-moves to **Infrequent Access** (`$12/TB`), and `90d+` transitions to **Glacier Deep Archive** (`$1/TB`)—slashing petabyte storage costs by **80%** with zero code changes.

idea:Lifecycle tiering works silently in the background—just verify cold-archive restore SLAs (minutes to hours) match your compliance or user download expectations.

Lifecycle PoliciesHot / Warm / Cold TiersDeep Archive ($1/TB)
STEP 09 · TECHNIQUEJump to step →

Guard against accidental deletes: Versioning & Object Lock

11 nines of disk durability won’t save you if a buggy cleanup script runs `s3 rm --recursive` or ransomware encrypts your bucket!

Enable **Bucket Versioning** (deletes only add a soft "delete marker" preserving old versions) and **Object Lock (WORM — Write Once, Read Many)** on compliance/backup buckets so not even a root admin can delete backups before expiry.

idea:Erasure coding protects against hardware failure; Bucket Versioning + Cross-Region Replication + Object Lock protect against human bugs and ransomware.

Bucket VersioningDelete MarkersWORM Object Lock
STEP 10 · RECAPJump to step →

Recap: petabyte-scale media architecture

Whenever a system handles images, videos, PDFs, ML weights, or database backups, follow the **Cloud Object Storage Blueprint**: never stream bytes through your API and never store blobs in SQL.

Use **Presigned URLs + Multipart Uploads** for direct ingress, **Content-Hashed Immutable Keys**, **Erasure Coding + Lifecycle Tiers** inside private buckets, **Async Transcode Queues**, and a **Global CDN (OAC)** for fast egress.

idea:Interview cheat code: draw the triangle — Client ↔ API (tiny presigned URL + metadata) and Client ↔ S3/CDN (direct multi-megabyte data plane).

Presigned URLsMultipartErasure CodingLifecycle + CDN

Related Production Deep-Dives & Simulators

Related Systems Course
Free · Verifiable Credential

FS-401RAG Engineer

Build evidence-carrying retrieval systems from ingestion and provenance through search reranking grounded generation and evaluation.

21 concepts~25h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.