System design interview approach and estimation

7 system design interview questions on interview approach and back of the envelope estimation, each with the correct answer and a full explanation.

The interviewer says "Design Twitter" and goes quiet. How do you run the next 45 minutes?
Show answer

Answer

Drive with a fixed structure.

  • Requirements (5 min): functional (post, follow, home timeline), non functional (read heavy, timeline p99 under about 200 ms, eventual consistency fine), explicit out of scope.
  • Estimates (3 min): only the numbers that drive a decision, such as read and write QPS and storage per year.
  • Core entities and API (5 min): POST /tweets, GET /timeline?cursor=.
  • High level design (10 min): walk one write and one read end to end.
  • Deep dives (15 min): the 2 or 3 hard parts (fanout, celebrities, partitioning), with tradeoffs.
  • Wrap up: bottlenecks, failure modes, what changes at 10x.

Pitfalls: boxes before scope, 15 minutes of math, naming tech without a reason, never stating a tradeoff.

Source: Hello Interview: System Design in a Hurry, System Design Interview: An Insider's Guide, Volume 1

100 million daily active users each post 10 times a day. What is the average write QPS?
Show answer

Answer

About 12,000 per second
100M x 10 = 1 billion writes a day. A day has about 86,400 seconds (round to 100,000 for mental math), so about 11,600 per second, call it 12k average and roughly 2x to 3x that at peak. 1,200 drops a factor of 10, usually by dividing by 864,000. 120,000 is what you get by forgetting a zero in the seconds per day. 1,000,000 divides by 1,000 instead of 86,400.

Source: System Design Interview: An Insider's Guide, Volume 1

A URL shortener stores 500 million new URLs per month, about 500 bytes per record, kept for 5 years. Roughly how much storage before replication?
Show answer

Answer

About 15 TB
500M x 12 x 5 = 30 billion records. 30 billion x 500 bytes = 15 x 1012 bytes = 15 TB. 1.5 TB and 150 TB are off by a factor of 10, the usual slip when counting zeros. 15 PB confuses 1012 with 1015. Mention replication (often 3x) separately.

Source: System Design Interview: An Insider's Guide, Volume 1

A video edge serves 1,000 requests per second, each a 1 MB segment. What network egress does it need?
Show answer

Answer

About 8 Gbps
1,000 x 1 MB = 1 GB/s, and network links are quoted in bits, so 1 GB/s is 8 Gbps. 1 Gbps is the bits versus bytes mistake. 800 Mbps drops a factor of 10 (100 MB/s times 8). 80 Gbps adds a factor of 10.

Source: System Design Interview: An Insider's Guide, Volume 1

Using the classic latency numbers, name the slowest: reading 1 MB from memory, reading 1 MB from SSD, a round trip inside one datacenter, or a round trip from California to the Netherlands.
Show answer

Answer

One network round trip from California to the Netherlands
A transatlantic round trip is about 150 ms, bounded by the speed of light. Reading 1 MB from memory is microseconds, 1 MB from SSD is about 1 ms or less, and a same datacenter round trip is about 0.5 ms. Candidates often overestimate disk and underestimate geography, which is why multi region writes are expensive.

Source: Latency Numbers Every Programmer Should Know

A service handles 2,000 requests per second with 50 ms average latency. How many requests are in flight on average?
Show answer

Answer

100
Little's law: L = lambda x W = 2,000/s x 0.05 s = 100. This sizes thread pools and connection pools. 40 is 2,000 divided by 50 (treating ms as a count). 2,000 confuses throughput with concurrency. 40,000 divides by 0.05 instead of multiplying.

Source: A Proof for the Queuing Formula: L = lambda W

You are interviewing at senior level. The high level design is done with 20 minutes left. What does the interviewer most want next?
Show answer

Answer

Pick the 2 or 3 hardest parts and go deep on tradeoffs and failure modes
Senior loops are graded on depth in a few areas: the bottleneck, contention point or failure mode, with the alternatives you rejected and why. More boxes is mid level breadth. Precise estimates rarely change a decision once the order of magnitude is known. A full schema burns time on detail that does not show judgement.

Source: Hello Interview: System Design in a Hurry, Hello Interview: Design Ticketmaster

These questions come from the System Design Interview Practice pack in Bertopia.

More system design topics

Practise these on your commute