Back of the Envelope Calculations for System Design: A Practical Guide

Back of the envelope calculations are invaluable in the early stages of system design. These rough, rapid estimates provide ballpark figures that help engineers and architects quickly assess feasibility and compare multiple approaches, guiding more detailed analysis and design.

What Are Back of the Envelope Calculations?

Back of the envelope calculations are quick, simplified estimates that allow you to gauge the magnitude of a problem or solution without getting bogged down in details. These calculations are not meant to be precise but provide an order of magnitude understanding that informs initial decisions.

Back of the Envelope

Why Use Back of the Envelope Calculations?

  1. Feasibility Assessment: Quickly determine whether a concept is worth pursuing further.
  2. Comparison of Alternatives: Evaluate and compare different design options early in the process.
  3. Resource Estimation: Get a rough idea of the resources (time, money, manpower) required.
  4. Communication: Explain concepts and decisions to stakeholders in an easily understandable way.

Key Components of Back of the Envelope Calculations

  • Simplification: Strip down the problem to its most essential components.
  • Assumptions: Make reasonable assumptions to fill gaps where precise data is unavailable.
  • Scaling Factors: Use known quantities and relationships to scale up or down to the desired context.
  • Order-of-Magnitude Estimation: Focus on getting the answer within an order of magnitude (e.g., tens, hundreds, thousands).

Steps to Perform Back of the Envelope Calculations

1. Define the Problem

Clearly state the question you are trying to answer. For instance, “How many servers are needed to handle a million users on a web application?”

2. Identify Key Variables

Determine the critical variables that will impact your calculation. For our example, key variables might include:

  • Number of requests per user per day
  • The average size of each request
  • Server capacity in terms of requests per second

3. Make Reasonable Assumptions

Since precise data may not be available, make educated guesses. For example:

  • Each user makes 10 requests per day.
  • Each request is 100KB in size.
  • Each server can handle 500 requests per second.

4. Perform the Calculation

Break down the problem into manageable parts and perform the necessary arithmetic. Continuing with our example:

  • Total requests per day: 1,000,000 users * 10 requests/user = 10,000,000 requests/day
  • Requests per second: 10,000,000 requests/day ÷ 86,400 seconds/day ≈ 116 requests/second
  • Number of servers: 116 requests/second ÷ 500 requests/second/server ≈ 0.23 servers

Since you can’t have a fraction of a server, you’d round up to 1 server.

5. Validate and Refine

Check if your result makes sense and adjust your assumptions if necessary. If 1 server seems too low given the typical load handling, you might revisit your assumptions or add a safety margin.

Commonly used acronyms:

  • QPS: Queries Per Second – the number of queries a system can handle per second.
  • TPS: Transactions Per Second – the number of transactions a system can process per second.
  • RPS: Requests Per Second – the number of requests a system can handle per second.
  • DAU: Daily active users – The number of daily active users
  • MAU: Monthly Active users -The number of monthly active users

Good to know

Powers

SizePower of 2Power of 10Full name
1 Kilobyte2^10 ~10^31 Thousand
1 Megabyte2^20~10^61 Million (10 Lakhs)
1 Gigabyte2^30~10^91 Billion (100 Crores)
1 Terabyte2^40~10^121 Trilion
1 Petabyte2^50~10^151 Quadrillion

Conversion

  • 1 KB = 1024 B
  • 1 MB = 1024 KB
  • 1 GB = 1024 MB
  • 1 TB = 1024 GB
  • 1 PB = 1024 TB

General Assumption

  • Each web server can handle 500 RPS
  • Each application server can handle 300 RPS
  • The database can handle 1000 transactions per second (TPS)
  • Peak QPS = 2 * QPS
  • Media: 1MB
  • Text: 140 bytes
  • id: 46 bytes

Examples of Back of the Envelope Calculations

Example 1: We need to build a system that can handle an average load of 1000 RPS. Each server can handle 500RPS Calculate the number of servers required.

Solution

RPS    = 1000
QRPS = 2* RPS = 2000 RPS

1 Server = 500RPS

Total server requires = 2000 / 500 = 4 Servers

Best Practices for Back of the Envelope Calculations

  1. Keep It Simple: Focus on the most critical factors and avoid unnecessary complexity.
  2. Document Assumptions: Clearly state your assumptions so others can follow your logic and challenge them if necessary.
  3. Use Ranges: Where appropriate, provide a range of estimates to account for uncertainty.
  4. Iterate: Refine your calculations as more data becomes available or assumptions change.

Conclusion

Back of the envelope calculations are a powerful tool in the early stages of system design, providing quick and rough estimates that guide more detailed analysis. By simplifying the problem, making reasonable assumptions, and focusing on order-of-magnitude accuracy, these calculations help assess feasibility, compare alternatives, and communicate ideas effectively. While not a substitute for detailed engineering analysis, they are an essential part of the engineer’s toolkit for rapid, early-stage decision-making.

Resources

Leave a Comment