Design a Photo Library
Design a personal cloud photo library. The phone app backs up every photo the user takes, in the background, and the user can browse their whole library as a timeline on any device, make albums, search by date and place, and share an album or a single photo with friends through a link. Deleted photos go to a trash for 30 days.
There are 500 million users, 100 million of them active each day, uploading 200 million photos a day at about 3 MB each. Every photo is kept forever unless deleted, so storage grows by about 200 PB a year. The hard parts are the bytes (480 Gbit/s of uploads on a holiday peak, from phones on weak networks), never losing a photo and never backing up the same one twice, making thumbnails for every upload, scrolling a library of 50,000 photos without a stutter, and keeping private photos private while sharing works with one tap.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1Photos only, or videos too?
- 2How many uploads?
- 3Must the original be kept?
- 4How big is a library?
- 5Do phones upload the same photo twice?
- 6What can be shared?
- 7Search?
- 8How fast must a new photo show up?
How to spend the 45 minutes
- 5minPart 1: Requirements and scope
- 5minPart 2: Estimates
- 5minPart 3: API and upload protocol
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Processing, sync, sharing and trade-offs