Design Cloud Photo Storage and Multi-Device Sync
Company: Apple
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
Design a cloud photo-storage service with upload, download, and multi-device synchronization.
Store photo bytes separately from searchable metadata. Support resumable uploads, multiple derived sizes, deletion, and a device catching up after being offline. Discuss hot versus cold media, consistency, deduplication, and recovery.
### Constraints & Assumptions
- A photo should not become visible in a library until its upload is complete.
- Retried upload or delete requests must be idempotent.
- Access control is evaluated before issuing media access.
### Clarifying Questions to Ask
- Is deletion immediately permanent or recoverable for a retention period?
- Are edits new immutable versions or in-place mutations?
- Is deduplication scoped to one account or global?
```hint Synchronize metadata changes
Devices can consume a per-account ordered change log and fetch blobs only when needed.
```
### What a Strong Answer Covers
- Multipart object upload, metadata transaction, finalization, and cleanup of abandoned uploads.
- A versioned library/change-log model for offline device sync.
- Object storage, derived assets, hot/cold tiers, caching, integrity, authorization, and deletion.
### Follow-up Questions
- How would two devices edit the same photo concurrently?
- How would you restore metadata if a database region is lost?
- How do you prevent a signed download URL from outliving revoked access?
Quick Answer: Design a cloud photo-storage service with upload, download, and multi-device synchronization. Connect requirements and APIs to data modeling, consistency, scaling, failure recovery, observability, and the important design trade-offs.