Bird
Raised Fist0
HLDsystem_design~25 mins

Back-of-the-envelope estimation in HLD - System Design Exercise

Choose your learning style10 modes available
Design: Back-of-the-envelope Estimation for System Design
Focus on quick, approximate calculations for system scale and performance. Detailed design and implementation are out of scope.
Functional Requirements
FR1: Estimate system capacity quickly with limited data
FR2: Calculate rough resource needs (servers, storage, bandwidth)
FR3: Provide latency and throughput approximations
FR4: Support decision making in early design phases
Non-Functional Requirements
NFR1: Estimates must be done within minutes
NFR2: Accuracy within an order of magnitude is acceptable
NFR3: Use simple math and assumptions
NFR4: No detailed data or simulations required
Think Before You Design
Questions to Ask
❓ Question 1
❓ Question 2
❓ Question 3
❓ Question 4
❓ Question 5
Key Components
User load estimations
Request size and frequency
Network bandwidth
Storage capacity
Compute resources (CPU, memory)
Design Patterns
Load estimation
Capacity planning
Latency and throughput approximation
Resource scaling heuristics
Reference Architecture
No specific architecture diagram needed for estimation; focus on calculation steps.
Components
User Load Estimator
Manual calculation or spreadsheet
Estimate number of concurrent users and requests per second
Data Size Calculator
Manual calculation or spreadsheet
Estimate average data size per request and total data volume
Resource Estimator
Manual calculation or spreadsheet
Estimate CPU, memory, storage, and bandwidth needs
Request Flow
1. 1. Define expected number of users and requests per second.
2. 2. Estimate average data size per request.
3. 3. Calculate total data throughput (requests per second * data size).
4. 4. Estimate storage needs based on data retention policies.
5. 5. Approximate CPU and memory based on request complexity.
6. 6. Check network bandwidth requirements against available capacity.
7. 7. Adjust estimates for peak load and safety margin.
Database Schema
Not applicable for back-of-the-envelope estimation.
Scaling Discussion
Bottlenecks
Underestimating peak traffic leading to resource exhaustion
Ignoring variability in request size or complexity
Not accounting for network latency or failures
Overlooking data growth over time
Solutions
Include safety margins (e.g., 2x peak load) in estimates
Use conservative assumptions for request size and complexity
Plan for horizontal scaling and load balancing
Regularly update estimates with real usage data
Interview Tips
Time: Spend 5 minutes clarifying assumptions, 15 minutes performing rough calculations, 5 minutes discussing results and trade-offs, 5 minutes answering questions.
Clarify assumptions and constraints before estimating
Explain each step of the calculation clearly
Discuss trade-offs between accuracy and speed
Mention how estimates guide design decisions
Highlight importance of revisiting estimates with real data

Practice

(1/5)
1. What is the main purpose of back-of-the-envelope estimation in system design?
easy
A. To quickly estimate system requirements using simple calculations
B. To write detailed code for the system
C. To create a full architecture diagram
D. To perform in-depth performance testing

Solution

  1. Step 1: Understand the goal of back-of-the-envelope estimation

    This method is used to quickly guess system needs without detailed work.
  2. Step 2: Compare options to the goal

    Only To quickly estimate system requirements using simple calculations matches the quick estimation purpose; others are detailed tasks.
  3. Final Answer:

    To quickly estimate system requirements using simple calculations -> Option A
  4. Quick Check:

    Quick estimation = To quickly estimate system requirements using simple calculations [OK]
Hint: Focus on quick, simple calculations for early guesses [OK]
Common Mistakes:
  • Confusing estimation with detailed design
  • Thinking it involves coding or testing
  • Assuming it requires full diagrams
2. Which of the following is the correct way to start a back-of-the-envelope estimation for a web service's daily traffic?
easy
A. Calculate exact user behavior with detailed logs
B. Estimate average users per hour and multiply by 24
C. Design the database schema first
D. Write the full API specification

Solution

  1. Step 1: Identify the starting point for traffic estimation

    Back-of-the-envelope estimation uses simple averages, not detailed data.
  2. Step 2: Evaluate options for simplicity and relevance

    Estimate average users per hour and multiply by 24 uses average users per hour times 24 hours, a simple and effective start.
  3. Final Answer:

    Estimate average users per hour and multiply by 24 -> Option B
  4. Quick Check:

    Simple average x time = Estimate average users per hour and multiply by 24 [OK]
Hint: Use simple averages and multiply by time units [OK]
Common Mistakes:
  • Starting with detailed logs instead of rough estimates
  • Jumping to design before estimating traffic
  • Confusing estimation with specification writing
3. You estimate a system will have 10,000 users daily, each making 5 requests on average. What is the total number of requests per day?
medium
A. 100,000 requests
B. 2,000 requests
C. 15,000 requests
D. 50,000 requests

Solution

  1. Step 1: Multiply users by requests per user

    10,000 users x 5 requests each = 50,000 requests.
  2. Step 2: Confirm total requests per day

    The total is simply the product of users and requests per user.
  3. Final Answer:

    50,000 requests -> Option D
  4. Quick Check:

    Users x requests = 50,000 [OK]
Hint: Multiply users by average requests per user [OK]
Common Mistakes:
  • Adding instead of multiplying
  • Mixing up users and requests
  • Choosing an option too large or too small
4. A designer estimated 1 million requests per day but forgot to consider peak hour traffic. What is the likely problem with this estimation?
medium
A. Ignoring average request size affecting storage needs
B. Overestimating total daily traffic causing wasted resources
C. Underestimating peak load leading to potential system overload
D. Not including user authentication time

Solution

  1. Step 1: Understand the impact of ignoring peak traffic

    Peak traffic is often much higher than average, so ignoring it underestimates load.
  2. Step 2: Identify the consequence of underestimation

    System may overload during peak times if capacity is based on average only.
  3. Final Answer:

    Underestimating peak load leading to potential system overload -> Option C
  4. Quick Check:

    Ignoring peak = underestimation risk [OK]
Hint: Always consider peak, not just average, traffic [OK]
Common Mistakes:
  • Assuming daily average covers peak needs
  • Confusing storage with traffic load
  • Focusing on unrelated factors like authentication time
5. You need to estimate the storage required for a photo-sharing app. Each photo is 3MB, and you expect 500,000 uploads per month. What is the approximate monthly storage needed?
hard
A. 1.5 TB
B. 150 GB
C. 15 GB
D. 1.5 GB

Solution

  1. Step 1: Calculate total storage in MB

    500,000 photos x 3 MB each = 1,500,000 MB.
  2. Step 2: Convert MB to TB

    1,500,000 MB ÷ 1024 ≈ 1465 GB ÷ 1024 ≈ 1.43 TB, approximately 1.5 TB.
  3. Final Answer:

    1.5 TB -> Option A
  4. Quick Check:

    Uploads x size ≈ 1.5 TB [OK]
Hint: Multiply count by size, then convert units [OK]
Common Mistakes:
  • Forgetting to convert MB to GB
  • Mixing up MB and GB units
  • Using wrong multiplication factors
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard