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.
| Database | Object storage | |
|---|---|---|
| Good for | Small rows you filter and join | Large blobs you fetch by key |
| Rough cost | Dollars per GB a month | About 2 cents per GB a month |
| Durability | As good as your backups | Copies across several data centers |
| Fetch time | A few ms | Tens 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.
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.
- The reader’s request reaches the nearest CDN server.
- On a miss, the CDN asks your app.
- The app looks up the item in the database to find its storage key.
- The app fetches the content from object storage.
- The CDN keeps a copy and sends it to the reader.
Cache headers decide everything
| Header | Meaning |
|---|---|
public, max-age=31536000, immutable | Anyone may cache this for a year and never needs to recheck it |
private, max-age=60 | Only the reader’s own browser may keep it, for a minute |
no-cache | Caches may keep it but must ask the origin before every reuse |
no-store | Nobody 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.