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.

## Table of Contents

## 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.

## Why Use Back of the Envelope Calculations?

**Feasibility Assessment**: Quickly determine whether a concept is worth pursuing further.**Comparison of Alternatives**: Evaluate and compare different design options early in the process.**Resource Estimation**: Get a rough idea of the resources (time, money, manpower) required.**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

Size | Power of 2 | Power of 10 | Full name |

1 Kilobyte | 2^10 | ~10^3 | 1 Thousand |

1 Megabyte | 2^20 | ~10^6 | 1 Million (10 Lakhs) |

1 Gigabyte | 2^30 | ~10^9 | 1 Billion (100 Crores) |

1 Terabyte | 2^40 | ~10^12 | 1 Trilion |

1 Petabyte | 2^50 | ~10^15 | 1 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

## 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

**Keep It Simple**: Focus on the most critical factors and avoid unnecessary complexity.**Document Assumptions**: Clearly state your assumptions so others can follow your logic and challenge them if necessary.**Use Ranges**: Where appropriate, provide a range of estimates to account for uncertainty.**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.