Skip to content
HLD Learn/Storage at Scale

Object, Block & File Storage

4 min read

You'll learn to

  • -Distinguish object storage from block and file storage

"Storage" so far has meant structured records in a database. Plenty of real data isn't rows at all (images, videos, backups, log dumps) and each of those has its own storage category with its own trade-offs.

Object Storage

A flat namespace of key-to-blob pairs (Amazon S3 is the archetype). There's no partial update (you replace the whole object), but it scales to effectively unlimited size and volume, and is the default home for user uploads, backups, and static assets served through a CDN.

ComponentBlobStorage

Blob (Binary Large Object) Storage is like an infinite digital warehouse where you can store files of any size and type. Images, videos, PDFs, backups, log archives, machine learning models, zip files, literally anything. Think of Amazon S3 as a magical closet: you put a file in, you get a URL back, and you can retrieve that file anytime from anywhere in the world. S3 stores over 100 trillion objects. It's designed for 99.999999999% durability (that's '11 nines'. The chance of losing a file is basically zero). The golden rule in system design: NEVER store files in your database. Store the file in blob storage, and store the URL/key in your database. Databases are built for structured rows and queries, not for holding 50MB video files.

Examples: AWS S3, Google Cloud Storage, Azure Blob Storage, Cloudflare R2 (zero egress fees), MinIO (self-hosted S3-compatible)

Block Storage

A raw virtual disk volume attached to a single machine (AWS EBS is the archetype): the storage layer a database or VM actually writes its files to. It supports fine-grained random reads and writes, unlike object storage, because it behaves like a real disk, not a key-value blob store.

File Storage

A shared, hierarchical filesystem (like NFS or AWS EFS) that multiple machines can mount simultaneously: familiar directory/file semantics, useful when several servers need to read and write the same files concurrently.

  • -Object storage: user uploads, backups, static assets. Cheap, infinitely scalable, whole-object writes.
  • -Block storage: what a database or VM's own disk is made of. Fast random access, tied to one machine at a time.
  • -File storage: shared files across multiple machines. Familiar semantics, higher operational cost than object storage.
Client
Web Server
Blob Storage
Database

A user upload goes straight to object storage; the application database only stores a reference to it.

ClientWeb Server- upload photoWeb ServerBlob Storage- store the actual bytesWeb ServerDatabase- store just the object key/URL
Interview Signal

Where should uploaded profile photos live: the application database, or object storage?

Weak Answer

"The database, so everything is in one place and easy to back up together."

Strong Answer

"Object storage, referenced by URL/key from the database, not the blob itself. Storing large binary data directly in a relational database bloats table size, slows down backups and replication (which now have to move all those bytes too), and wastes an expensive, low-latency-optimized store on data that doesn't need row-level query semantics at all. The database should hold a pointer; S3-style storage should hold the bytes."

ScaleDojo Logo
Initializing ScaleDojo