Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 65 Β· Thinking in Systems

What Is System Design?

Learn what system design means, how high-level and low-level design differ, the design life cycle, and how to sketch a system as boxes and arrows.

A program that works on your laptop for one user is not a system. A system is many parts (clients, servers, databases, queues, caches, networks) that cooperate to serve many users, keep working when pieces fail, and stay affordable as they grow. System design is the practice of deciding which parts you need, how they talk to each other, and which trade-offs you accept.

This course teaches that practice step by step. Every idea comes with a diagram and, where possible, a small Python simulation you can run in the page, so you can watch a cache fill, a load balancer choose a server, or a queue back up instead of just reading about it. This first lesson sets the vocabulary and the habits you will use in every later chapter.

Why system design matters

Most products start as one server and one database. That is a perfectly good design until something changes: ten times more users, a new country with long network delays, a database disk that fills up, a deploy that takes the site down for ten minutes. Each of those is a design problem, and the answer is rarely "write faster code". It is usually "add a part", "split a part" or "stop one part from depending on another".

Good system design gives you:

  • Capacity to grow without rewriting everything.
  • Resilience: one failed machine does not mean a failed product.
  • Speed that users can feel, even far from your data center.
  • Cost control: you pay for what the workload needs, not ten times more.
  • A shared picture that a whole team can discuss and change.

High-level design and low-level design

Design happens at two zoom levels.

High-level design (HLD) is the map of the whole system: the major components, what each is responsible for, what data flows between them, and what technologies fit. It answers "which boxes, and how are they connected?". Low-level design (LLD) zooms into one box: its classes, interfaces, methods, database tables and algorithms. It answers "how is this one component built?".

Two zoom levels

High-level design Boxes, arrows, data flow, technologies.
Low-level design Classes, methods, schemas, algorithms.
They need each other HLD sets the limits, LLD fills them in.

This course is mostly HLD, with LLD where it matters.

1 / 2

A tiny example makes the difference clear. For a URL shortener, the HLD says: "A web tier behind a load balancer, a key-value store for short codes, a cache for hot links, an analytics queue." The LLD of the key-value store says: "A table with columns code, long_url, created_at; the code is a base-62 encoding of a counter; collisions are impossible because the counter is unique."

The design life cycle

Design is not a one-time activity before coding. It is a loop, usually described in these stages:

flowchart LR
  A["Requirements"] --> B["Estimate scale"]
  B --> C["High-level design"]
  C --> D["Detailed design"]
  D --> E["Build and test"]
  E --> F["Deploy and operate"]
  F --> G["Measure and learn"]
  G --> A

Figure: the system design life cycle is a loop. Production data feeds the next round of requirements.

  1. Gather requirements. What must the system do, and how well? (Requirements lesson)
  2. Estimate scale. How many users, requests, bytes? (Capacity estimation)
  3. Design the high-level architecture. Pick components and connect them.
  4. Design the details. APIs, data models, algorithms, failure handling.
  5. Build and test, including load tests and failure tests.
  6. Deploy and operate with monitoring, alerts and runbooks.
  7. Measure and iterate. Real traffic always differs from the estimate.

Do not aim for the "perfect" design. Aim for the simplest design that meets today's requirements and has an obvious path to the next 10x. Extra components cost money, add failure modes and slow the team.

Drawing a design: boxes, arrows, labels

A design you cannot draw is a design you do not yet understand. A useful diagram shows components (boxes), data flow (arrows with a verb or protocol), and data stores (cylinders). Here is a first, deliberately simple web system:

flowchart LR
  U["Users"] --> LB["Load balancer"]
  LB --> W1["Web server 1"]
  LB --> W2["Web server 2"]
  W1 --> C[("Cache")]
  W2 --> C
  W1 --> DB[("Database")]
  W2 --> DB

Figure: a typical starting architecture. Each box is a chapter of this course.

Notice the questions the picture raises. What if the database dies? What if the cache is empty? What decides which web server gets a request? Those questions are exactly what the next chapters answer.

A system as a pipeline you can simulate

Before the real components arrive, it helps to see what "a system under load" means. Below is a minimal simulation of a single server that can handle a fixed number of requests per second. We send a growing load and watch what happens to requests it cannot serve.

Python One server, growing load

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Up to its capacity the server keeps up and the backlog stays at zero. Past capacity the backlog grows every second, which in real life means timeouts, errors and unhappy users. System design is largely about where you put capacity, and how you keep any single box from being the one that overflows.

Systems have trade-offs, always

Every design choice gives something and takes something. A few you will meet repeatedly:

  • Consistency vs availability: do all users see the same data instantly, or does the system keep answering during a failure?
  • Latency vs throughput: doing work in batches is efficient but slower per item.
  • Simplicity vs flexibility: a monolith is simple; microservices are flexible and harder to run.
  • Cost vs performance: more replicas and caches are faster and cost more.

The next snippet turns one of these into numbers: how a cache trades memory for speed. It is a thought experiment, and the later caching chapter does it properly.

Python A first trade-off: memory for speed

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A 90% hit rate cuts average latency by roughly a factor of eight here, but you now have a second component to run, size and keep correct. Nothing is free.

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. Which description best fits high-level design?

    HLD is the map of the whole system. Classes and methods belong to low-level design.
  2. 2. Why is the design life cycle drawn as a loop?

    Real traffic and failures teach you things the first estimate could not, so you go around again.
  3. 3. In the one-server simulation, what happens when offered load exceeds capacity?

    Work arrives faster than it is finished, so the queue keeps growing until requests time out.
  4. 4. What is a good attitude toward adding components?

    Each component costs money and adds failure modes, so add them for a reason you can state.

Summary

  • A system is many cooperating parts serving many users; system design chooses the parts and their connections.
  • HLD is the whole-system map; LLD is the detail inside one component.
  • The design life cycle is a loop: requirements, estimates, HLD, detailed design, build, operate, measure.
  • Draw boxes, arrows and data stores; every question the diagram raises is a design topic.
  • Every choice is a trade-off: consistency, latency, simplicity and cost pull against each other.

Next: Functional and Non-Functional Requirements