03 Back of The Envelope Estimation
03 Back of The Envelope Estimation
00 Foreword 03
01 Join the Community
Back-of-the-envelope Estimation
In a system design interview, sometimes you are asked to estimate system capacity or performance
Scale From Zero To Millions Of requirements using a back-of-the-envelope estimation. According to Jeff Dean, Google Senior Fellow, “back-of-
02
Users the-envelope calculations are estimates you create using a combination of thought experiments and common
performance numbers to get a good feel for which designs will meet your requirements” [1].
Back-of-the-envelope
03 You need to have a good sense of scalability basics to effectively carry out back-of-the-envelope estimation.
Estimation
The following concepts should be well understood: power of two [2], latency numbers every programmer
A Framework For System Design should know, and availability numbers.
04
Interviews
Power of two
05 Design A Rate Limiter
Although data volume can become enormous when dealing with distributed systems, calculation all boils down
to the basics. To obtain correct calculations, it is critical to know the data volume unit using the power of 2. A
06 Design Consistent Hashing byte is a sequence of 8 bits. An ASCII character uses one byte of memory (8 bits). Below is a table explaining
the data volume unit (Table 1).
07 Design A Key-value Store Power Approximate value Full name Short name
10 1 Thousand 1 Kilobyte 1 KB
Design A Unique ID Generator In
08
Distributed Systems 20 1 Million 1 Megabyte 1 MB
30 1 Billion 1 Gigabyte 1 GB
09 Design A URL Shortener
40 1 Trillion 1 Terabyte 1 TB
50 1 Quadrillion 1 Petabyte 1 PB
https://bytebytego.com/courses/system-design-interview/back-of-the-envelope-estimation Page 1 of 6
ByteByteGo | Technical Interview Prep 31/10/23, 3:40 PM
50 1 Quadrillion 1 Petabyte 1 PB
Table 1
Branch mispredict 5 ns
L2 cache reference 7 ns
Table 2
Notes
1 ns = 10^-9 seconds
A Google software engineer built a tool to visualize Dr. Dean’s numbers. The tool also takes the time factor into
consideration. Figures 2-1 shows the visualized latency numbers as of 2020 (source of figures: reference
material [3]).
Figure 1
https://bytebytego.com/courses/system-design-interview/back-of-the-envelope-estimation Page 3 of 6
ByteByteGo | Technical Interview Prep 31/10/23, 3:40 PM
Data centers are usually in different regions, and it takes time to send data between them.
Availability numbers
High availability is the ability of a system to be continuously operational for a desirably long period of time. High
availability is measured as a percentage, with 100% means a service that has 0 downtime. Most services fall
between 99% and 100%.
A service level agreement (SLA) is a commonly used term for service providers. This is an agreement between
you (the service provider) and your customer, and this agreement formally defines the level of uptime your
service will deliver. Cloud providers Amazon [4], Google [5] and Microsoft [6] set their SLAs at 99.9% or above.
Uptime is traditionally measured in nines. The more the nines, the better. As shown in Table 3, the number of
nines correlate to the expected system downtime.
Availability % Downtime per day Downtime per week Downtime per month Downtime per year
Table 3
Assumptions:
Estimations:
tweet_id 64 bytes
text 140 bytes
media 1 MB
Tips
Back-of-the-envelope estimation is all about the process. Solving the problem is more important than obtaining
results. Interviewers may test your problem-solving skills. Here are a few tips to follow:
Rounding and Approximation. It is difficult to perform complicated math operations during the interview. For
example, what is the result of “99987 / 9.1”? There is no need to spend valuable time to solve complicated
math problems. Precision is not expected. Use round numbers and approximation to your advantage. The
division question can be simplified as follows: “100,000 / 10”.
Write down your assumptions. It is a good idea to write down your assumptions to be referenced later.
Label your units. When you write down “5”, does it mean 5 KB or 5 MB? You might confuse yourself with
this. Write down the units because “5 MB” helps to remove ambiguity.
Commonly asked back-of-the-envelope estimations: QPS, peak QPS, storage, cache, number of servers,
etc. You can practice these calculations when preparing for an interview. Practice makes perfect.
Congratulations on getting this far! Now give yourself a pat on the back. Good job!
https://bytebytego.com/courses/system-design-interview/back-of-the-envelope-estimation Page 5 of 6
ByteByteGo | Technical Interview Prep 31/10/23, 3:40 PM
Reference materials
[1] J. Dean.Google Pro Tip: Use Back-Of-The-Envelope-Calculations To Choose The Best Design:
http://highscalability.com/blog/2011/1/26/google-pro-tip-use-back-of-the-envelope-calculations-to-choo.html
Our Team
Privacy Policy
Terms of Service
https://bytebytego.com/courses/system-design-interview/back-of-the-envelope-estimation Page 6 of 6