Overview of System Design
System design is the process of planning the architecture, components, data and communication of a software system so that it meets its goals. It helps engineers build systems that are scalable, fast, reliable and easy to maintain, before a single line of production code is written.
This tutorial explains system design in simple terms: why it matters, the building blocks every system uses, the core ideas such as scalability and availability, a step-by-step design process, and a complete example of an online bookstore.
1. What Is System Design?
Writing code solves a single problem inside one program. System design looks at the whole picture: how many servers you need, where data is stored, how parts talk to each other, what happens when something fails, and how the system grows when more people use it.
A good system design answers questions like these:
- What should the system do, and for how many users?
- Which parts (services, databases, caches, queues) are needed, and how do they connect?
- How is data stored, read and kept safe?
- How does the system keep working when a server or network fails?
- How will it handle ten or a hundred times more traffic in the future?
2. Why Is System Design Important?
- Scalability: The system can handle growth in users, requests and data without a full rewrite.
- Performance: Pages and APIs respond quickly, even when many people use them at once.
- Reliability and Availability: The system stays up and keeps data safe, even when some parts fail.
- Maintainability: Clear boundaries make it easier to fix bugs and add features without breaking existing ones.
- Security: Sensitive data such as passwords and payment details is protected from the start.
- Cost Control: You use the right amount of infrastructure instead of over- or under-buying servers.
- Career Growth: System design is a core skill for senior engineers and a standard part of technical interviews.
3. Functional and Non-Functional Requirements
Every design starts with requirements. They come in two types:
| Type | Question It Answers | Bookstore Examples |
|---|---|---|
| Functional | What should the system do? | Search books, add to cart, place an order, write a review |
| Non-functional | How well should it do it? | Search results in under 200 ms, 99.9% availability, support 1 million daily users, secure payments |
Non-functional requirements usually drive the big design decisions. Learn more in Functional vs Non-Functional Requirements.
4. High-Level vs Low-Level Design
| Aspect | High-Level Design (HLD) | Low-Level Design (LLD) |
|---|---|---|
| Focus | The big picture: services, databases, caches, queues | The details inside one component: classes, methods, tables |
| Output | Architecture diagram and data flow | Class diagrams, API contracts, database schemas |
| Audience | Architects, team leads, stakeholders | Developers implementing the feature |
| Example | "Use a load balancer, three app servers, PostgreSQL and Redis" | "OrderService.placeOrder() validates stock, then saves an Order" |
See High-Level vs Low-Level Design for a deeper comparison.
5. Key Components of System Design
Most large systems are built from the same set of building blocks:
| Component | What It Does | Common Examples |
|---|---|---|
| Architecture | Defines how the parts of the system are organised and interact | Monolith, microservices, event-driven |
| Clients | The apps people use to reach the system | Web browser, mobile app |
| DNS | Turns a domain name into a server address | Route 53, Cloudflare DNS |
| Load Balancer | Spreads incoming traffic across many servers | NGINX, HAProxy, AWS ELB |
| Application Servers | Run the business logic | Spring Boot services |
| APIs | Let clients and services talk to each other | REST, gRPC, GraphQL |
| Data Storage | Stores data safely for later use | PostgreSQL, MySQL, MongoDB |
| Cache | Keeps frequently used data in fast memory | Redis, Caffeine |
| Message Queue | Lets services work asynchronously and absorb traffic spikes | Kafka, RabbitMQ |
| CDN | Serves images and static files from servers close to the user | CloudFront, Cloudflare |
| Object Storage | Stores large files such as images and videos | Amazon S3, Google Cloud Storage |
| Security | Protects data and allows only authorised access | HTTPS, OAuth 2.0, JWT |
| Monitoring | Shows health, errors and performance | Prometheus, Grafana, ELK |
6. Core Concepts
Scalability
Scalability is the ability to handle more load by adding resources. There are two ways to scale:
| Aspect | Vertical Scaling (Scale Up) | Horizontal Scaling (Scale Out) |
|---|---|---|
| How | Give one server more CPU, RAM or disk | Add more servers behind a load balancer |
| Simplicity | Very simple; no code changes | Needs stateless services and a load balancer |
| Limit | Stops at the biggest available machine | Can keep growing by adding machines |
| Failure | One server is a single point of failure | Other servers keep working if one fails |
Availability
Availability is the percentage of time a system is up and working. It is often written as a number of "nines":
| Availability | Allowed Downtime per Year | Allowed Downtime per Month |
|---|---|---|
| 99% ("two nines") | About 3.65 days | About 7.3 hours |
| 99.9% ("three nines") | About 8.77 hours | About 43.8 minutes |
| 99.99% ("four nines") | About 52.6 minutes | About 4.4 minutes |
| 99.999% ("five nines") | About 5.3 minutes | About 26 seconds |
Higher availability comes from redundancy (more than one copy of every important part) and failover (switching to a healthy copy automatically). Read more in Availability in System Design.
Latency and Throughput
- Latency is how long one request takes, for example 120 ms to load a page. Lower is better.
- Throughput is how many requests the system handles per second. Higher is better.
Caching, CDNs, efficient queries and fewer network hops reduce latency. See Latency in System Design.
Consistency and the CAP Theorem
Consistency means every user sees the same, latest data. In a distributed system, the CAP theorem says that when the network splits (a partition), you must choose between:
- Consistency: refuse some requests so nobody sees outdated data, or
- Availability: keep answering every request, even if some answers are slightly out of date.
A bank balance usually favours consistency; a social media like counter usually favours availability. See Consistency in System Design.
7. A Step-by-Step Design Process
Whether you are designing a real product or answering an interview question, these steps give you a clear path:
- Clarify requirements: List the main features and the non-functional goals (users, speed, availability).
- Estimate the scale: Roughly calculate requests per second, storage and bandwidth.
- Draw the high-level design: Clients, load balancer, services, databases, caches and queues.
- Design the data model: Choose databases and define the main tables or documents.
- Define the APIs: Decide the endpoints, inputs and outputs.
- Deep dive into key parts: Search, payments or whatever is hardest or most important.
- Find bottlenecks and failures: Ask "what breaks first?" and add caching, replicas or queues.
- Review trade-offs: Explain why you chose each option and what you gave up.
For more detail, see System Design Process and Methodologies.
8. Example: Designing an Online Bookstore
Imagine building an online bookstore. System design helps you decide:
- Which database will store books, users and orders?
- How will users search for books quickly?
- How will the site handle thousands of users at the same time?
- How will payment information stay secure?
- What happens if a server crashes during a big sale?
Step 1: Requirements
- Functional: browse and search books, view details, add to cart, place orders, pay online.
- Non-functional: 1 million daily active users, search in under 200 ms, 99.9% availability, secure payments.
Step 2: Back-of-the-Envelope Estimation
Daily active users = 1,000,000
Requests per user per day = 10
Requests per day = 10,000,000
Average requests/second = 10,000,000 / 86,400 ≈ 116 req/s
Peak (about 3x average) ≈ 350 req/s
Books in catalog = 1,000,000
Book details (2 KB each) ≈ 2 GB -> fits easily in one database
Cover images (200 KB each) ≈ 200 GB -> object storage + CDN
These rough numbers tell us that one database can hold the catalog, but images belong in object storage behind a CDN, and a few app servers behind a load balancer can comfortably handle the traffic.
Step 3: High-Level Architecture
Users (web / mobile)
|
|---------------------------> [ CDN ] <--- book cover images (object storage)
v
[ Load Balancer ]
|
+--> App Server 1 --+
+--> App Server 2 --+--> [ Redis Cache ] (popular books)
+--> App Server 3 --+
|
+--> [ PostgreSQL ] (books, users, orders)
+--> [ Search Engine ] (fast full-text search)
+--> [ Message Queue ] --> Email / Shipping workers
Step 4: Key Decisions
- Database: PostgreSQL for books, users and orders, because orders need reliable transactions.
- Fast search: a search engine such as Elasticsearch, kept in sync with the database.
- Handling many users: stateless app servers behind a load balancer, plus a Redis cache for popular books.
- Images: object storage with a CDN, so images load quickly worldwide.
- Slow tasks: confirmation emails and shipping requests go through a message queue, so checkout stays fast.
- Security: HTTPS everywhere, hashed passwords, and a trusted payment provider so card details never touch our servers.
- Reliability: at least two app servers and a database replica, so one failure does not stop the store.
By planning all these aspects up front, the bookstore can run smoothly, handle growth and give users a good experience.
9. Common Trade-offs
There is no perfect design, only good trade-offs for a given situation:
| Trade-off | Option A | Option B |
|---|---|---|
| Consistency vs Availability | Always correct data, may reject requests during failures | Always responds, data may be briefly outdated |
| Latency vs Freshness | Cache data for speed | Read the database every time for the latest value |
| SQL vs NoSQL | Strong structure, joins and transactions | Flexible schema and easy horizontal scaling |
| Monolith vs Microservices | Simple to build and deploy | Independent teams and scaling, more complexity |
| Sync vs Async | Immediate answer, tighter coupling | Better resilience, eventual results |
| Cost vs Performance | Fewer, cheaper servers | More capacity and redundancy |
Explore architecture choices in Monolithic Architecture and Microservices Architecture.
10. Tips for Beginners
- Always start with requirements; never jump straight to technologies.
- Keep the first design simple, then improve it where the numbers say it is needed.
- Do rough math for traffic and storage; it guides every big decision.
- Remove single points of failure by having at least two of everything important.
- Keep application servers stateless so they are easy to scale out.
- Cache data that is read often and changes rarely.
- Move slow work, such as emails and reports, to background queues.
- Design for failure: use timeouts, retries and health checks.
- Plan monitoring and alerts from day one.
- Explain every choice with its trade-off; "it depends" is fine if you say on what.
11. Conclusion
System design is a critical skill for developers and engineers. It turns a list of features into a blueprint that is scalable, reliable, fast, secure and affordable. Start with clear requirements, estimate the scale, combine well-known building blocks such as load balancers, databases, caches and queues, and always explain your trade-offs. Learning system design helps you think bigger and plan smarter, and the rest of this System Design Tutorial will take you deeper into each topic.