Back-of-the-envelope estimation

Rough numbers worked out in minutes: powers of two, latency, availability nines, and a full worked example from daily users to requests per second, storage, bandwidth, servers and cache size.

Overview

A back-of-the-envelope estimate is a calculation rough enough to do in your head or on a corner of the whiteboard, and good enough to make a design decision. It answers questions like: does the data fit on one machine, how many servers will we need, is a cache worth it, can one database take these writes?

Interviewers ask for estimates for two reasons. The numbers decide the design: a system with 100 writes a second and one with 100,000 are different systems. And the way you estimate shows how you think: whether you state assumptions, keep units straight, round sensibly and notice when a result is absurd.

This chapter gives you the reference numbers to memorize (powers of two, latency, availability) and then works one example from start to finish. The example is LiftLog, a made-up workout-tracking app with 20 million daily users, a feed of friends' workouts, and optional photos. Every number in the later sections comes from the assumptions stated at the start, so you can follow each step and redo it with your own.

What you will be able to do

  • Convert between powers of two and storage units without hesitating.
  • Say the rough latency of memory, SSD, disk, a data center round trip and a cross-continent round trip, and what those gaps mean for a design.
  • Turn an availability target into allowed downtime, and work out the availability of parts in series and in parallel.
  • Go from daily users to peak requests per second, storage per year, bandwidth, server count and cache size.
  • Present the numbers so the interviewer can follow, check and challenge them.

Key concepts

  • Powers of two
  • Latency numbers
  • Availability nines
  • Series and parallel availability
  • Daily counts to per-second rates
  • Peak factor
  • Storage growth
  • Bandwidth
  • Server count
  • Little's Law
  • Cache sizing
  • Presenting the numbers

Interview questions

  • Estimate the requests per second for a service with 50 million daily users who each make 20 requests a day.
  • How much downtime does 99.99% availability allow?
  • A request passes through a load balancer at 99.99%, an app tier at 99.9% and a database at 99.95%. What is the availability, and how would you raise it?
  • How do you estimate storage for a photo-sharing service?
  • Why plan servers to run at about 60% rather than near 100%?
  • What is Little's Law and how do you use it in a design?
  • How would you size a cache?
  • What latency numbers should every engineer know, and why do they matter?
  • What are the most common mistakes in back-of-the-envelope estimates?
  • How long should estimation take in an interview, and what should it produce?

Sign up free to read the full topic

More System Design topics

Start free on Cariara · Coding problems · System design studio