Course contents

01. System Design Fundamentals Lesson 1 of 8

What Is System Design?

Watch a one-server app grow: requirements, bottlenecks, load balancers and caches, and why every design decision is a trade-off.

10 minBeginner7 steps
Loading the interactive simulation…
Loading the knowledge check…

Summary

  • System design is choosing components and their connections so a system meets its requirements.
  • Functional requirements say what the system does; non-functional ones (latency, availability, scale) shape the architecture.
  • A bottleneck is the first component to run out of capacity; it caps the whole system.
  • Fixing one bottleneck moves the limit elsewhere, often to a shared database.
  • Every building block has a cost: more parts, more money, weaker consistency or more to operate.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

System design is the work of deciding which components a software system is made of (servers, databases, caches, queues, load balancers), how they talk to each other, and where data lives, so that the system meets its requirements. Code design asks how to structure one program; system design asks how many programs there are, on how many machines, and what happens when one of them is slow or gone.

Why it exists

A single program on a single machine is enough for many products, at first. It stops being enough when the requirements outgrow it: more users than one machine can serve, a promise to stay up when hardware fails, users on other continents who need fast answers, or data too large for one disk. At that point there are many possible architectures, each with different costs. System design is how you choose one deliberately instead of by accident.

How it works

The work tends to follow a loop:

  1. Clarify requirements. Functional requirements list what the system does (upload a photo, show a feed). Non-functional requirements state how well: latency targets ("P95 under 200 ms"), availability ("99.9%"), expected load and growth, durability, consistency, cost and compliance. The second list drives the architecture.
  2. Estimate. Rough numbers turn vague goals into constraints: requests per second at peak, data size per year, read/write ratio. They tell you whether one database will do or whether you need to partition.
  3. Sketch a simple design. Start with the fewest components that meet the functional requirements.
  4. Find the bottleneck. Ask which component runs out first as load grows or which failure takes everything down.
  5. Apply a building block. A load balancer and more servers for compute, a cache for repeated reads, replicas for availability and read scale, a queue to absorb bursts, sharding for data that outgrows one machine.
  6. State the trade-off and repeat. Each block removes one limit and adds a cost; the next bottleneck is somewhere else.

The lesson's simulation runs this loop once: one server saturates, three servers behind a load balancer fix that, the shared database becomes the limit, and a cache relieves it.

When to use it

Any time the system's qualities matter as much as its features: before building something expected to grow, when an existing system is slow or fragile, when adding a feature that changes load patterns (a feed, search, notifications), and in technical interviews, which use it to see how you reason about trade-offs.

When not to

Do not design for scale you do not have. A prototype or an internal tool with a few hundred users is usually best served by one server and one managed database. Every extra component costs money, has failure modes of its own and must be understood by whoever is on call. Design for the next order of magnitude, not the next three, and keep the option to change later.

Trade-offs

Decision You gain You pay
More servers behind a load balancer Capacity, tolerance of a server failure A balancer to run, servers must be stateless
A cache in front of the database Lower latency, less database load Possibly stale reads, invalidation logic, another component
Database replicas Availability, read capacity Replication lag, failover complexity
A message queue Absorbs bursts, decouples services Asynchronous flows are harder to reason about and debug
Splitting into services Independent deploys and scaling Network calls, partial failures, distributed data

Alternatives

There is no alternative to designing; there is only designing explicitly or implicitly. The real choice is how much to design up front. Some teams sketch a full target architecture early; others grow one incrementally, refactoring when measurements show a limit. Most do a mix: decide early the things that are expensive to change (data model, partitioning key, consistency guarantees) and defer the cheap ones (number of servers, cache placement).

Failure modes

  • Designing for the wrong requirement. Optimising latency when the real problem is availability, or the reverse.
  • Over-engineering. Microservices, queues and multi-region setups for a product with no users yet. The complexity slows every change.
  • Ignoring the shared component. Scaling the stateless tier while every request still lands on one database.
  • No numbers. Without estimates, "it will scale" is a guess.
  • Hidden single points of failure. A redundant app tier that depends on one DNS provider, one database or one region.

In production

Real designs are shaped by constraints a whiteboard leaves out: budget, the team's experience, existing systems, compliance, and the operational cost of every component. Managed services (databases, queues, load balancers) remove much of that cost and are usually the right default. Designs are revisited when metrics show a limit approaching, ideally before users feel it, which is why monitoring of latency, error rate and saturation is part of the design, not an afterthought.

Common misconceptions

  • "System design is only for huge companies." Any system with users has a design; small ones just have simple designs.
  • "There is one correct architecture." There are several reasonable ones; the right one depends on the requirements and the constraints.
  • "Adding servers fixes performance." Only when servers are the bottleneck. If the database is saturated, more servers add load to it.
  • "A design is finished once it is drawn." Load, features and teams change; the bottleneck moves with them.

Interview angle

Interviewers want to see the loop, not a memorised diagram. Start by asking about requirements and scale, write down a few numbers, sketch a simple design, then improve it by naming bottlenecks and failure modes yourself. For each component you add, say why and what it costs. Saying "this cache means a user may see a profile picture up to 60 seconds old; that is acceptable here" scores better than drawing the cache without comment.

Model assumptions

The simulation is a simplified model, not a benchmark. Each app server has 8 workers and spends about 20 ms per request plus one database query; a worker waiting for the database stays busy. The database has 6 connections and about 25 ms per query (lognormal times). Network hops take a fixed 1–25 ms. The cache answers a fixed 80% of lookups in about 2 ms; there is no staleness or eviction in this model. Arrivals are random (Poisson). Utilisation is the share of busy workers or connections, not CPU. Numbers show behaviour and orders of magnitude only.

The lesson as textEvery step of the simulation, written out.
  1. 1. An idea, one server and a database

    Say you are building a photo-sharing app. The first version is the simplest thing that works: users send requests to one application server, which stores and reads data in one database.

    At 20 requests per second it is barely busy, and every request succeeds. Nothing here needs designing yet.

    Scene: Users send requests to App 1, which queries the database. App 1 is lightly loaded and every request succeeds.

    Key idea: Every system starts as a few components and the connections between them.

  2. 2. What must it do, and how well?

    Functional requirements say what the system does: upload a photo, show a feed, follow a friend. Non-functional requirements say how well: answer in under 200 ms, stay up 99.9% of the time, cope with ten times today’s users.

    System design is mostly about the second list. The same features can be built in many ways; the qualities you need decide which way is right.

    Scene: The same scene, annotated: the users want features (upload, view, follow); the system must also be fast, available and able to grow.

    Key idea: Features say what to build; qualities like latency, availability and scale decide how to build it.

  3. 3. The app becomes popular

    A second in, traffic jumps from 20 to 200 requests per second. One server can finish only about 160 per second, so its workers stay busy, its waiting line fills up and it starts refusing requests with errors (red packets).

    The database is still coping. The part that limits the whole system right now is the app server: that is the bottleneck.

    Scene: Traffic rises to 200 requests per second. App 1 is fully busy with a full queue and rejects some requests; the database still has spare connections.

    Key idea: A bottleneck is the component that runs out of capacity first and caps the whole system.

  4. 4. Add servers and a load balancer

    We run three copies of the app and put a load balancer in front, so users still see one address. Each server now gets about a third of the traffic and is less than half busy.

    The errors stop. This is the design loop in miniature: find the bottleneck, pick a building block that removes it, check the result.

    Scene: Users send requests to a load balancer that spreads them over App 1, 2 and 3. All three use the same database. Each server is about half busy and nothing fails.

    Key idea: Design is a loop: measure, find the bottleneck, change the architecture, measure again.

  5. 5. The bottleneck moves

    Traffic keeps growing, to 320 requests per second. Three app servers could do almost 500 on their own, but every request needs a database query, and the database runs only about 240 per second. Its connections are all in use and queries queue up.

    The app servers now look full too, but their workers are just waiting for the database, so their queues overflow and they reject requests. Throughput is stuck near what the database can do, and a fourth app server would not raise it.

    Scene: At 320 requests per second the database is the bottleneck: all its connections are busy and queries queue. The app servers fill up waiting for it and reject some requests; throughput stays near 240 per second.

    Key idea: Removing a bottleneck moves the limit to the next component, often a shared one like the database.

  6. 6. A cache takes reads off the database

    Most requests read the same popular photos. We add a cache: each server asks it first and only queries the database on a miss. Here 80% of lookups hit, so the database sees about a fifth of the traffic.

    Errors stop and latency drops. The price: cached data can be slightly out of date, and there is one more component to run and keep consistent.

    Scene: A cache sits beside the database. App servers check the cache first; 80% of lookups hit, so the database is lightly loaded again. Nothing fails and latency is lower.

    Key idea: Every building block solves one problem and brings a new cost; design is choosing which costs you can live with.

  7. 7. What system design is

    We started from requirements, found the bottleneck, and added a load balancer, more servers and a cache. Each step was a trade-off: more capacity for more parts to operate, faster reads for possibly stale data.

    That is the whole discipline at small scale: choose components and how they talk so the system meets its requirements, and know what each choice costs. The rest of this Lab goes deep on each building block.

    Scene: The final design: users, a load balancer, three app servers, a cache and a database. Everything is healthy at 320 requests per second.

    Key idea: System design means choosing components and connections that meet the requirements, and being explicit about the trade-offs.