Design Google Photos
Understanding the Problem
📷 What is Google Photos? Google Photos backs up the photos and videos from your phone, organizes them into a scrolling timeline by date, and lets you view them at full quality on any device, build albums and share them. Most photos are uploaded once, looked at a few times in the first week, and then rarely touched again, but users expect every one of them to be there forever.
You may also be asked "how would you store and serve images at Facebook or Instagram scale?" That's the same problem seen from the serving side: billions of immutable images, each requested in several sizes, with a heavy skew toward recent ones. We'll design the backup product and spend the deep dives on storage tiers and image serving, which is where both questions meet.
Functional Requirements
Core Requirements
- Users should be able to upload photos and videos, including automatic backup from their phone.
- Users should be able to browse their library as a timeline, newest first.
- Users should be able to view any photo at the size their screen needs, from a grid thumbnail to full resolution.
- Users should be able to create albums and share them with other people.
Below the line (out of scope)
- Search by content ("dogs at the beach"), face grouping and other ML features. We'll note where they hook in.
- Editing photos, printing and memories/highlights.
- Video streaming details beyond storing the file (see
/system-design/youtubefor adaptive streaming).
Non-Functional Requirements
Ask your interviewer about scale. For our design: 1B users, 500M daily active, and about 2 billion new photos and videos per day, averaging around 3 MB each.
Core Requirements
- Uploaded media must be extremely durable. Losing someone's family photos is unacceptable.
- Thumbnails in the timeline should load in under ~200 ms, so scrolling feels instant.
- Uploads must survive flaky mobile networks and resume where they left off.
- Storage cost must stay under control as the library grows forever.
- The system should be highly available for viewing; a brief delay before a new upload appears on other devices is fine.
Below the line (out of scope)
- Strong consistency across devices. Eventual consistency of the library (seconds) is fine.
Back of the envelope. 2B uploads a day is about 23,000 uploads per second on average, maybe 50,000 at peak (evenings, holidays). At 3 MB each that's 6 PB of new originals per day, or roughly 2 EB per year, before replication. Reads are dominated by thumbnails: if each daily user scrolls past 100 thumbnails a day, that's 50B thumbnail requests per day, around 600,000 per second on average and a few million per second at peak.
Two things jump out. Storage grows by exabytes a year, so how many copies we keep and on what kind of disk is the biggest cost lever in the system. And reads are skewed: most views are of photos from the last few days, while the bulk of the bytes are old photos almost nobody looks at.
The insight that drives the design: access is highly skewed by age, and bytes are dominated by originals while requests are dominated by thumbnails. So we keep small, popular things (thumbnails, recent photos) on fast storage and in caches, and push large, cold things (old originals) onto the cheapest durable storage we have.