You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
System design is the process of defining the architecture, components, modules, interfaces, and data flow for a system to satisfy specified requirements. Whether you are preparing for interviews or building real-world products, understanding system design fundamentals is essential.
Modern software rarely runs on a single machine. Even a simple web application typically involves:
Understanding how these pieces fit together is what separates developers who build prototypes from engineers who build products that serve millions.
Every system design starts with requirements gathering. There are two categories:
These describe what the system should do:
These describe how well the system should perform:
| Requirement | Description | Example |
|---|---|---|
| Scalability | Handle growing load | 100M daily active users |
| Availability | Uptime percentage | 99.99% (52 min downtime/yr) |
| Latency | Response time | p99 < 200ms |
| Consistency | Data correctness | Strong or eventual |
| Durability | Data is not lost | No data loss on failure |
| Security | Protection from threats | Encryption at rest/transit |
Tip: Non-functional requirements often drive the most important architectural decisions. Two systems with identical features can have completely different architectures based on their scale and latency requirements.
Before diving into design, estimate the scale of the system. This helps you choose appropriate technologies and architectures.
┌────────────────────────────────────────────────────────┐
│ Latency Numbers Every Engineer │
│ Should Know (Approx.) │
├────────────────────────────────────────────────────────┤
│ L1 cache reference ..................... 0.5 ns │
│ Branch mispredict ...................... 5 ns │
│ L2 cache reference ..................... 7 ns │
│ Mutex lock/unlock ...................... 25 ns │
│ Main memory reference .................. 100 ns │
│ SSD random read ....................... 150 μs │
│ Read 1 MB sequentially from memory .... 250 μs │
│ Round trip within same data centre .... 500 μs │
│ Read 1 MB sequentially from SSD ....... 1 ms │
│ HDD seek ............................. 10 ms │
│ Read 1 MB sequentially from HDD ....... 20 ms │
│ Send packet US-East → US-West ......... 40 ms │
│ Send packet US → Europe ............... 80 ms │
│ Send packet US → Australia ............ 150 ms │
└────────────────────────────────────────────────────────┘
Assume:
Read QPS = 200M × 100 / 86,400 ≈ 230,000 reads/sec
Write QPS = 200M × 2 / 86,400 ≈ 4,600 writes/sec
Daily storage = 200M × 2 × 800 bytes ≈ 320 GB/day
Annual storage ≈ 320 GB × 365 ≈ 117 TB/year
Tip: You do not need exact numbers. The goal is to determine the order of magnitude — thousands vs millions vs billions of operations per second.
Use a structured approach when tackling any system design problem:
┌─────────────────────────────────────────────────────────┐
│ System Design Process │
├─────────────────────────────────────────────────────────┤
│ │
│ 1. CLARIFY 2. HIGH-LEVEL 3. DEEP DIVE │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Ask │──────▶│ Draw │───────▶│ Detail │ │
│ │ questions│ │ boxes & │ │ each │ │
│ │ & scope │ │ arrows │ │ component│ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │ │
│ ▼ │
│ 4. WRAP UP │
│ ┌──────────┐ │
│ │ Trade-offs│ │
│ │ & next │ │
│ │ steps │ │
│ └──────────┘ │
└─────────────────────────────────────────────────────────┘
Before we dive deeper in later lessons, here is a quick overview of the main building blocks:
| Component | Purpose |
|---|---|
| Load Balancer | Distributes requests across servers |
| Web Server | Handles HTTP requests |
| Application Server | Runs business logic |
| Database | Persistent storage (SQL or NoSQL) |
| Cache | Fast in-memory storage for hot data |
| CDN | Serves static content close to users |
| Message Queue | Asynchronous communication between services |
| Search Index | Full-text or structured search |
| Object Storage | Large files (images, videos, backups) |
| API Gateway | Entry point for client requests |