← Lessons

quiz vs the machine

Gold1410

System Design

The Post Storage And Media

Splitting lightweight post metadata from heavy media behind a content store and CDN.

4 min read · core · beat Gold to climb

Two very different objects

A post is really two things. There is the metadata, a small record with author id, text, timestamp, and counters. And there is the media, large blobs like images and video.

These have different needs, so they live in different systems.

Metadata storage

  • Post metadata goes in a database keyed by post id, often partitioned by post id or author.
  • It is small, structured, and read constantly when building feeds.
  • Feeds store only ids, then hydrate by fetching these records in batches.

Media storage

  • Media goes in an object store designed for large immutable blobs.
  • The metadata record holds a reference, a url or key, not the bytes.
  • Media is served through a content delivery network so bytes come from a server near the user.

Why split them

Mixing tiny metadata and huge media in one store would make feed reads slow and storage costly. Separating them lets the feed read small records fast while media streams efficiently from the edge.

Key idea

Posts split into small metadata in a database and large media in an object store fronted by a CDN, so feeds read fast records while media streams from the edge.

Check yourself

Answer to earn rating on the learn ladder.

1. Why store post metadata and media separately?

2. What does a feed store to reference a post?

3. How is media usually served to users?