What is System Design?
Why System Design Matters
Imagine you're building a treehouse. You could just start nailing boards together and hope for the best. But if you want it to hold 5 friends, survive a storm, and have a rope ladder — you need a plan.
System design is that plan, but for software. It's the art of deciding how to build something before you write a single line of code. Which database should you use? How will millions of users connect at the same time? What happens when a server crashes at 3 AM?
Every app you love — Instagram, YouTube, Google Maps — started with someone sketching boxes and arrows on a whiteboard. That sketch is system design.
Functional vs Non-Functional Requirements
Before designing anything, you need to know what you're building and how well it needs to work. These split into two buckets:
- Functional requirements — What the system does. "Users can upload photos." "Users can send messages." Think of these as the features on the box.
- Non-functional requirements — How the system behaves. "The page loads in under 200ms." "The system handles 10 million users." "Data is never lost." Think of these as the fine print.
Here's a trick: non-functional requirements are where interviews get interesting. Anyone can say "users can post tweets." The real challenge is making it work for 500 million users with 99.99% uptime.
Common non-functional requirements include:
- Scalability — Can it grow?
- Availability — Is it always up?
- Latency — Is it fast?
- Consistency — Does everyone see the same data?
- Durability — Is data safe even if servers explode?
The Design Process
Great system design follows a repeatable recipe. Think of it like building with LEGO — you follow the steps, but you still get to be creative.
Step 1: Understand the problem. What are we building? Who uses it? What are the most important features?
Step 2: Estimate the scale. How many users? How much data? How many requests per second? (More on this below.)
Step 3: Define the API. What endpoints or interfaces will the system expose? This is the contract between your system and the outside world.
Step 4: Design the high-level architecture. Draw the big boxes — clients, servers, databases, caches, load balancers. Show how data flows between them.
Step 5: Deep-dive into components. Pick the most interesting or tricky part and zoom in. How does the database schema look? What caching strategy do you use?
Step 6: Address bottlenecks. What breaks first when traffic spikes? Where are the single points of failure? How do you handle them?
Back-of-the-Envelope Estimation
System design loves big numbers. You'll often need to estimate things like "how much storage does YouTube need per day?" This is called back-of-the-envelope estimation — quick, rough math to guide your design decisions.
Here are the key numbers you'll work with:
- DAU (Daily Active Users) — How many people use the app each day.
- QPS (Queries Per Second) — How many requests hit your servers each second. If 10M users each make 10 requests/day:
10M × 10 / 86400 ≈ 1,157 QPS. - Storage — How much disk space you need. If each user uploads one 2MB photo/day with 10M DAU:
10M × 2MB = 20TB/day. - Bandwidth — How much data flows in/out.
20TB/day ÷ 86400 ≈ 231 MB/s.
Some handy numbers to memorize:
- 1 day = 86,400 seconds (round to ~100K for quick math)
- 1 million requests/day ≈ ~12 QPS
- 1 char = 1 byte, 1 int = 4 bytes, 1 long/timestamp = 8 bytes
- A typical tweet-sized text = ~300 bytes
- A typical image = 200KB–2MB
- A typical video (1 min) = 50–100MB
Quick Estimation Helper
Common Building Blocks
Almost every system design uses the same set of LEGO pieces. Learning these is like learning your ABCs — once you know them, you can spell anything.
- Load Balancer — Distributes traffic across multiple servers so no single server gets overwhelmed.
- Cache — A fast temporary storage (like RAM) that saves you from hitting the slow database every time.
- Database — Where your data lives permanently. SQL for structured data, NoSQL for flexible data.
- Message Queue — A line where tasks wait to be processed, so your system doesn't choke during traffic spikes.
- CDN (Content Delivery Network) — Servers spread around the world that serve static files (images, videos) from a location near the user.
- API Gateway — The front door of your system that handles authentication, rate limiting, and routing.
In the following lessons, we'll deep-dive into each of these. By the end, you'll be able to combine them like a pro to design systems that handle millions of users.