← All articles

Object storage and CDNs for storing blobs and serving them fast

Updated Nov 8, 2026 · 3 min read

Many systems store blobs, like images, videos, documents and pasted text. They are written once, read many times and rarely queried by their contents. Two tools handle them well. Object storage keeps them cheaply and durably, and a CDN serves them from servers close to whoever is reading.

Split metadata from content

The usual design keeps a small row per item in the database (its id, owner, size, created and expiry times, and the storage key) and puts the content itself in object storage such as S3, Google Cloud Storage or R2. The database stays small and fast to query and back up, and the bulk lives where a gigabyte costs a few cents a month.

DatabaseObject storage
Good forSmall rows you filter and joinLarge blobs you fetch by key
Rough costDollars per GB a monthAbout 2 cents per GB a month
DurabilityAs good as your backupsCopies across several data centers
Fetch timeA few msTens of ms for the first byte

Avoid the app server’s local disk. It is lost when the server is replaced, and other servers cannot see it.

uploadrowcontentWriterApp serverDatabaseid, owner, keyObject storagethe bytes
Small rows you query go to the database. The bytes go to object storage, found by the key in the row.

What a CDN does

A CDN is a network of cache servers in hundreds of cities. A reader’s request goes to the nearest one. On a hit it answers in a few milliseconds without touching your servers. On a miss it fetches from your origin, keeps a copy and serves the next reader nearby from that copy.

  1. The reader’s request reaches the nearest CDN server.
  2. On a miss, the CDN asks your app.
  3. The app looks up the item in the database to find its storage key.
  4. The app fetches the content from object storage.
  5. The CDN keeps a copy and sends it to the reader.
12miss345kept copyReaderCDNnearest cityApp serverDatabaseObject storage
A CDN miss, step by step. The copy it keeps answers the next reader nearby.

Cache headers decide everything

HeaderMeaning
public, max-age=31536000, immutableAnyone may cache this for a year and never needs to recheck it
private, max-age=60Only the reader’s own browser may keep it, for a minute
no-cacheCaches may keep it but must ask the origin before every reuse
no-storeNobody may keep a copy at all

Sizing it

A million 10 KB items is 10 GB. A billion is 10 TB. A year is about 365 days, so 5 million new 10 KB items a day adds roughly 18 TB a year. That is small for object storage and very large for a database, which is the whole case for keeping them apart.

When one item goes viral

A single link shared widely can send tens of thousands of reads a second to one item. Without a CDN every read reaches your app and your database. With one, nearly all of them are answered at the edge, and your origin sees roughly one request per CDN location per cache lifetime.

Reads a second20,000/s
Reaching your servers~2,000/s
A viral item at 20,000 reads a second, with a CDN answering 90% at the edge.