Skip to the page

Running the round · core

Back-of-the-envelope estimation

Estimate with round numbers: users, actions, seconds in a day, size per item and a peak factor. The result must tell you if one machine, a cache or a CDN is needed.

The notes

What you must know

  • A day is about 10 to the power 5 seconds (86,400). One crore is 10 to the power 7. Use these to turn daily counts into per-second rates.
  • Say assumptions out loud. Example photo app: 10 crore daily users, 10 percent upload one photo (1 crore uploads), each user opens the feed 10 times and sees 20 photos (2,000 crore views a day).
  • Rates: 1 crore uploads over 86,400 seconds is about 115 a second, perhaps 500 at peak. Feed: 100 crore requests a day is about 11,600 a second, perhaps 50,000 at peak.
  • Storage: about 2 MB per original plus 300 KB of resized versions gives about 23 TB a day and 8.4 PB a year before copies. With 3 replicas or erasure coding at about 1.5 times, plan for 13 to 25 PB.
  • Bandwidth: 2,000 crore views at 100 KB is about 2 PB a day, about 185 Gbps on average, so nearly all of it must come from a CDN.
  • Servers: at 2,000 to 5,000 feed requests a second per node, 50,000 at peak needs 10 to 25 nodes plus headroom across zones. Cache memory and database queries are the numbers to watch, not app servers.
  • URL shortener example: 100 million a month is about 40 writes a second, and 100 times more reads is about 4,000 a second on average, so plan for 10 times at peak. Seven base62 characters give about 3.5 trillion codes.
  • Handy latency numbers: a memory read is about 100 ns, an SSD read about 100 microseconds, and a round trip inside a data centre about 0.5 ms.

The red pen

Common traps: mistake → fix

  • Mistake: Exact arithmetic shows skill

    Fix: round numbers are expected; ten minutes of exact math wastes time.

  • Mistake: Average load is the design target

    Fix: always add a peak factor.

  • Mistake: Storage is the original size

    Fix: add copies and resized versions.

  • Mistake: Numbers are a ritual

    Fix: a number that never changes the design should be dropped.

Easy to hard

Questions interviewers ask, easy to hard

  1. Estimate the storage for a photo app with 10 crore daily users.
  2. How many requests per second is 100 crore a day?
  3. Why do the numbers say you need a CDN?
  4. How many app servers does 50,000 requests per second need?

Practise

Practise with these questions

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview