Sub topic 1
Start with the problem, not the boxes
Prerequisites
Assume you understand basic client-server architecture, HTTP APIs, databases, and short Python snippets.
Start with the problem
System design begins with behavior, not services. Ask:
- Who uses the system?
- What actions must users perform?
- Which data must the system store?
- What happens during a failure?
- Which constraints matter most: latency, availability, cost, or consistency?
For example, “design a messaging system” is incomplete. A useful version might be: “Users send text messages to one another. Messages should appear within two seconds, remain available after a server failure, and support 10 million daily users.”
These statements determine the architecture. Drawing boxes before clarifying them usually produces an attractive design that solves the wrong problem.
Pin down functional and non-functional requirements
Functional requirements describe what the system does. Non-functional requirements describe how well it does it.
| Type | Example |
|---|---|
| Functional | Create an item, retrieve an item, list a user’s items |
| Non-functional | 99.9% monthly availability and p95 reads under 200 ms |
Ask the interviewer or stakeholders to rank priorities. “Strong consistency everywhere” may conflict with low latency across regions. A design needs an explicit decision.
Set scope and write down your assumptions
State what you will include and exclude. For a first version, you might support text only, one region, authenticated users, and cursor-based pagination. Exclude search, recommendations, and analytics unless they affect the core design.
Write assumptions with numbers. For example:
- 10 million daily active users
- 5 writes and 100 reads per user per day
- 500 bytes per stored record
- Peak traffic is twice the daily average
Label estimates as assumptions. This makes the design easy to revise when a requirement changes.
Estimate traffic, storage, and bandwidth
Convert daily totals into rates by dividing by 86,400 seconds. The following estimate uses decimal gigabytes and terabytes.
DAU = 10_000_000
writes_per_user = 5
reads_per_user = 100
record_bytes = 500
seconds_per_day = 86_400
write_qps = DAU * writes_per_user / seconds_per_day
read_qps = DAU * reads_per_user / seconds_per_day
storage_gb_day = DAU * writes_per_user * record_bytes / 1e9
write_bandwidth_mb_s = write_qps * record_bytes / 1e6
print(f"average writes: {write_qps:.0f} QPS")
print(f"average reads: {read_qps:.0f} QPS")
print(f"storage per day: {storage_gb_day:.1f} GB")
print(f"write bandwidth: {write_bandwidth_mb_s:.2f} MB/s")These values are about 579 writes per second, 11,574 reads per second, 25 GB per day, and 0.29 MB/s of write payload. Add replication, indexes, metadata, response sizes, and peak factors before choosing capacity.
Exercise
Why should peak traffic be estimated separately from average traffic?
Show answer
Averages hide bursts. Capacity based only on averages can cause high latency or failures during busy periods.