Practice/Google/Design Google Photos
Design Google Photos
System DesignOptional
Problem Statement
You are designing a cloud-based photo storage and sharing platform similar to Google Photos. The system allows users to upload photos and videos from their mobile devices, organizes them into a chronological timeline, and lets users browse, search, and share their media with others. Users expect uploads to be fast and resumable — if a connection drops mid-upload, the transfer should pick up where it left off rather than restarting. Once uploaded, the platform generates thumbnails and optimized previews for quick browsing.
The browsing experience must feel instantaneous. Users scroll through potentially tens of thousands of photos in a timeline view powered by infinite scroll with cursor-based pagination. Tapping on a photo opens a full-screen viewer where users swipe between adjacent photos, and the app must prefetch neighboring images so transitions feel seamless. All media is served through a CDN for low-latency delivery regardless of the user's geographic location.
Sharing is a core feature: users create albums, add photos to them, and share albums with specific people via links or direct invitations. Shared album recipients can view (and optionally contribute to) the album, with permissions controlled by the album owner. The system must handle billions of photos across hundreds of millions of users while keeping storage costs manageable and maintaining high availability.
Key Requirements
Functional
- Resumable photo and video uploads -- Users upload media from mobile devices with support for resumable transfers that survive network interruptions without losing progress
- Thumbnail and preview generation -- The system automatically generates multiple image sizes (thumbnail, preview, full resolution) upon upload for efficient browsing at different zoom levels
- Timeline browsing with infinite scroll -- Users browse their photo library in reverse-chronological order with cursor-based pagination that loads smoothly as they scroll
- Album sharing with permissions -- Users create albums, invite others to view or contribute, and control access through granular permission settings
Non-Functional
- Scalability -- Support hundreds of millions of users storing billions of photos, with upload throughput handling millions of new photos per day
- Latency -- Thumbnail grids load within 500 milliseconds; full-resolution images render within 2 seconds; swipe transitions between photos feel instantaneous with prefetching
- Availability -- Upload and browse paths maintain 99.9% availability independently; a processing pipeline backlog must not block user-facing operations
- Cost efficiency -- Optimize storage costs through tiered storage, deduplication, and efficient encoding while serving billions of daily image requests via CDN
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Resumable Upload Protocol
Large photo and video files need a reliable upload mechanism that handles unreliable mobile networks. Interviewers want to see a concrete protocol design, not just a hand-wave at "chunked uploads."
Hints to consider:
- Think about splitting files into fixed-size chunks (e.g., 1-2 MB) and uploading each independently with a chunk sequence number
- Consider how the server tracks which chunks have been received so the client can resume by querying for missing chunks
- Plan for out-of-order chunk arrival and how you reassemble the complete file once all chunks are present
- Decide how you handle duplicate chunk uploads from retries — idempotent writes keyed on upload session ID plus chunk number
2. Thumbnail Generation Pipeline
Generating multiple image sizes asynchronously at upload scale is a classic distributed systems challenge. Interviewers probe your pipeline design for throughput, reliability, and how quickly thumbnails become available.
Hints to consider:
- Think about triggering thumbnail generation as soon as the upload completes, publishing an event to Kafka that image processing workers consume
- Consider generating three sizes — small thumbnail (200px), medium preview (800px), and keeping the original — and storing each in S3 with a predictable key pattern
- Plan for processing failures: retries with exponential backoff, dead-letter queues, and a reconciliation job that detects photos missing thumbnails
- Decide whether to block the upload response until at least the thumbnail is ready or return immediately and let the client poll or receive a push when ready
3. Infinite Scroll and Full-Screen Prefetching
The browsing experience must feel fluid even with libraries containing tens of thousands of photos. Interviewers look for your pagination strategy and how you minimize perceived latency during swipe navigation.
Hints to consider:
- Use cursor-based pagination keyed on upload timestamp and photo ID to ensure stable ordering as new photos are added
- Think about how the client requests the next page of thumbnail URLs while the user is still scrolling, maintaining a buffer of pre-loaded pages
- For full-screen swipe view, consider prefetching the preview-resolution images for 2-3 photos in each direction from the currently viewed photo
- Plan for the gap between thumbnail grid and full-screen view: the client can display the already-loaded thumbnail scaled up while the higher-resolution preview loads
4. Album Sharing and Permission Model
Shared albums introduce multi-user access control that must be enforced consistently across uploads, browsing, and search. Interviewers probe your data model and how you handle permission changes.
Hints to consider:
- Think about modeling albums as entities with an owner and an access control list stored alongside the album metadata in the database
- Consider how shared album photos appear in both the owner's timeline and the recipient's shared view without duplicating the underlying media
- Plan for permission revocation: when a user is removed from an album, their access to those photos must be revoked promptly across all surfaces
- Decide whether contributors to a shared album retain ownership of their contributed photos if they leave the album