AI Hints
Home›System Design Tutorial›Storing More Kinds of Data
System Design · Lesson 50 of 120

Object Storage

Files and photos.

⏱ 2 min read▶ Video at 59:07🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

Shoply's product photos don't belong in the database. Databases are built for small, structured rows, not megabytes of image data. Big files go into object storage.

Object Storage
From the video: Object Storage
  • Photos aren't rows
  • Databases want small data
  • Use object storage

Storing a product photo

Here's the usual pattern. The seller uploads a photo. The app stores the file in object storage, like Amazon S three, under a unique key. The database stores only that key, plus details like the size. And a CDN serves the photo to customers around the world.

  1. Upload
  2. Object storage
  3. Key in database
  4. CDN serves it
Storing a product photo
From the video: Storing a product photo

Why object storage

Object storage is built for this job. It's cheap per gigabyte. It's practically unlimited. It keeps several copies of every file, so it's extremely durable. And it works over plain HTTP. What it doesn't do is edit files in place. You replace the whole object.

keyvalue
Cheappennies per GB
Unlimitedno disks to manage
Durablemany copies
Whole objectsreplace, don't edit

Summary

Big files go into object storage, the database keeps just their keys, and a CDN delivers them. Next, how search boxes find words so fast.

Key takeaways
  • Files in object storage
  • Keys in the database
  • CDN in front
Next up: Search Indexes — the inverted index