2. Back-of-Envelope Estimation
2.8 How do you estimate storage over the years?
At the wedding: For a three-day wedding, you stock rice for all three days, plus a bit extra in case a sack spoils.
In the system: Storage grows every day and rarely shrinks. The formula:
storage = writes per day × size of each write × days × years × copies
PicShare (assumed): 2 million uploads a day, 2 MB each, kept for 1 year, stored 3 times for safety (replicas, Chapter 14).
- Per day: 2 million × 2 MB = 4 TB.
- Per year: 4 TB × 365 = 1.46 PB.
- With 3 copies: about 4.4 PB a year.
Now the metadata (photo ID, owner, caption, time): about 1 KB per photo.
- Per day: 2 million × 1 KB = 2 GB. Tiny next to 4 TB.
That gap is a design decision in itself: the photos go in object storage (Chapter 11), built for huge files, while the metadata goes in a database, built for fast lookups. Same app, two very different storage problems.
Memory code: "Writes × size × days × copies." And always split the small stuff (metadata) from the big stuff (media).