WhatsApp System Design

Media Sharing

3 min read

Sending text messages is simple.

Sending a 20 MB video to a group of 500 people is a completely different challenge.

Uploading that file 500 times would waste enormous bandwidth.

Modern messaging systems avoid this completely.


Upload Once

Instead of uploading the same media for every recipient,

the sender uploads it only once.


Sending the Message

After the upload finishes,

the chat message only contains metadata.

Example

Message ID

Conversation ID

Media ID

Encrypted Media Key

Caption

Timestamp

Notice that the actual image is not inside the message.


Delivery

Recipients download the media directly from Object Storage or a CDN.

The messaging server never repeatedly transfers the same image.


Why Object Storage?

Object storage systems are designed for

  • Images

  • Videos

  • Audio

  • Documents

Examples include

  • Amazon S3

  • Google Cloud Storage

  • Azure Blob Storage

These systems are far more efficient than relational databases for large files.


CDN

Popular media is cached at edge locations.

Instead of downloading from one central server,

users receive media from the nearest CDN node.

Benefits

  • Lower latency

  • Lower bandwidth

  • Better scalability


Local Cache

Once downloaded,

media is cached locally.

Opening the same photo again usually does not require another network request.


Interview Notes

Interviewer

If you send one photo to 500 people,

is it uploaded 500 times?

Answer

No.

The media is uploaded once,

stored in object storage,

and the message contains only metadata.

Recipients download the same object independently.


Key Takeaways

✔ Upload once.

✔ Store large media in object storage.

✔ Messages contain metadata, not the actual file.

✔ CDN reduces latency.

✔ Local caching avoids repeated downloads.