SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
  • What is System Design?
  • High-Level Design (HLD)
  • Low-Level Design (LLD)
  • Functional vs Non-Functional Requirements
  • Back-of-the-Envelope Estimation
  • Numbers Every Engineer Should Know
  • SLA, SLO and SLI
  • Basic OS: Process, Thread, Memory
  • 30 Must-Know Concepts
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
Part 8: Operations and Security
Part 9: Estimation and Interview Method
Part 10: Case Studies
System Design/Foundations/Introduction

What is System Design?

Planning how the parts of a software system fit together, so it works for millions of people.

⏱ 10 min readBeginnerMust KnowHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

System design is the work of planning how the parts of a software system fit together, so that it works well for many people.

  • You decide the parts: servers, databases, caches, queues and more.
  • You decide how the parts talk to each other.
  • You make choices and accept trade-offs, because no design is perfect.
  • Good design means the system stays fast, stays up and can grow.

02Concept: What is it?

Writing code answers: “How do I build this one feature?” System design answers a bigger question: “How do all the parts of the product work together when millions of people use it?”

Coding (low-level)
Inside one program
  • Which loop or data structure to use
  • How to write one function or class
  • Does this code give the right answer?
System design (high-level)
Across many programs and machines
  • How many servers do we need?
  • Where do we keep the data?
  • What happens when a server dies?

Two parts of design

🧱High-level design (HLD)
The big picture: the main parts and how they connect. Servers, database, cache, queue.
🔬Low-level design (LLD)
The inside of one part: classes, methods and data shapes.
🧠Remember
There is no single “right” design. There is only a design that fits the needs best, with trade-offs you can explain.

03Real-Life Example

🍵Building a city, not just a house
Building one house is easy: one builder, one plan. Now imagine a whole city for a million people. You need roads, water pipes, power lines, hospitals and rules. Each part must work with the others. If you plan badly, you get traffic jams and power cuts. System design is city planning for software.
A city and a software system
The city
🛣️Roadsmove people
🚦Traffic policeshare traffic
🏬Shopsdo the work
🏦Bankskeep valuables
↔same idea
The software system
🌐Networkmoves requests
⚖️Load balancershares requests
🖥️App serversdo the work
🗄️Databasekeeps the data
The same ideas appear in both: roads carry traffic, services do jobs, storage keeps things safe.
City
Software system
Roads
Network
Traffic police
Load balancer
Shops and offices
App servers
Banks and warehouses
Databases and storage
Post office with a queue
Message queue
More roads when the city grows
Scaling

04Why Do We Need It?

A bad design may work for 100 users and fall apart for 100,000. A good design saves time, money and sleep.

📈Handle growth
More users and more data should not break the product.
🛡️Stay up
When one machine fails, users should not notice.
⚡Be fast
Pages and apps should answer in a blink.
💰Control cost
Use the right amount of machines, not too many.
🔧Easy to change
New features should not need a full rewrite.
💼Pass interviews
Almost every senior interview has a design round.
Fixing a weak design later costs far more than thinking about it early.

05Where Do We Use It?

You use system design any time many users, much data or many parts are involved.

💬Chat apps
WhatsApp, Telegram: deliver messages fast and in order.
🎬Streaming
Netflix, YouTube: send video to millions at once.
🛒Shopping
Product search, cart, payments and orders.
🚕Ride booking
Match riders with nearby drivers in seconds.
💳Payments
UPI and cards: never lose or repeat a payment.
🔍Search
Google: search billions of pages quickly.

Where you will meet it in your career

  • Planning a new product or feature at work.
  • Finding out why a system is slow or keeps crashing.
  • Design rounds in interviews (“Design Instagram”, “Design a URL shortener”).

06Types / Parts / How It Works

Most systems are built from the same small set of building blocks. Learn these blocks and you can design almost anything.

The common building blocks
👥Users
→↓
🌍CDNstatic files
→↓
⚖️Load balancer
→↓
🖥️App
🖥️App
→↓
⚡Cache
🗄️Database
📬Queue
Users / queue CDN Load balancer App servers Cache Database
A typical web system. You will learn each block in this course.

The layers of a system

1Clientsbrowser, phone app
2EdgeDNS, CDN, load balancer
3Applicationservers with your code
4Speed layercache, queues
5Datadatabases, file storage

The main qualities we design for

QualityEasy question it answers
ScalabilityCan it grow with more users?
AvailabilityIs it up when I need it?
ReliabilityDoes it give correct answers, even when parts fail?
LatencyHow long does one request take?
ConsistencyDo all users see the same data?
CostCan we afford to run it?
VisualizerWatch a system grow from 10 to 1 million usersPress Next. Each step adds one new building block (shown with a glow).
👥10users
→↓
🖥️One serverapp + database together
Step 1 of 5
Day 1: one server does everything
With 10 users, one machine can run the app and keep the data. Simple and cheap. No big design needed yet.

07How to Use It / Steps / Implementation

In an interview or at work, you can follow the same steps every time.

  1. 1
    Ask questions and find the needs
    What does the system do? Who uses it? How many users?
  2. 2
    Write the requirements
    Functional: what it does. Non-functional: speed, uptime, scale.
  3. 3
    Estimate the size
    Users, requests per second, data per day. Rough numbers are enough.
  4. 4
    Draw the big picture
    Boxes and arrows: clients, servers, database, cache.
  5. 5
    Design the data
    What do we store? Which database fits?
  6. 6
    Go deep on the hard parts
    Pick the busiest or riskiest part and design it well.
  7. 7
    Find bottlenecks and failures
    What breaks first? Add copies, caches, queues.
  8. 8
    Explain trade-offs
    Say what you chose, what you gave up, and why.
💡Start small
First make a simple design that works. Then improve it step by step. Do not begin with 50 boxes.

08Key Terms to Know

TermMeaning in easy words
RequirementSomething the system must do or be (like “load in under 1 second”)
Functional requirementA feature: what the system does (post a photo, send a message)
Non-functional requirementA quality: how well it does it (fast, always up, secure)
ComponentOne part of the system, like a server or a database
Trade-offGetting one good thing by giving up another
BottleneckThe slowest part, which limits the whole system
LoadThe amount of work: users, requests, data
ArchitectureThe overall shape of the system and how parts connect
HLD / LLDHigh-level design (big picture) and low-level design (inside one part)
Back-of-the-envelopeA quick rough calculation to get the size of the problem

09Pros, Cons and Trade-offs

✅ Pros
  • Fewer surprises when traffic grows
  • Failures are planned for
  • Easier teamwork: everyone shares the same picture
  • Saves money in the long run
⚠️ Cons
  • Takes time before any code is written
  • Too much design can create a system that is too complex
  • Early guesses about traffic can be wrong
  • Needs experience to judge trade-offs
⚠️Do not over-design
A small project with 100 users does not need 20 servers and 6 databases. Design for what you need now, and leave room to grow.

10Common Problems and Mistakes

Common mistakes

  1. Jumping into the design without asking questions. You may build the wrong thing.
  2. Using fancy tools just because they are popular. Pick tools that fit the need.
  3. Forgetting failures. Servers, disks and networks do fail.
  4. Ignoring the data. The database often decides if the system works.
  5. Never saying the trade-offs. Every choice has a cost. Say it out loud.
  6. Over-engineering. Complex designs are hard to run and hard to fix.
Under-design vs over-design
Too simple
🖥️One serverfor 10 million users
💥 Crashes
Just right
⚖️Load balancer
🖥️A few servers + DB
✅ Fits the need
Too complex
🕸️50 servicesfor 100 users
💸 Costly, hard to run

11Real-World Examples

These are general ideas about how well-known products think about design. The real details inside each company are more complex.

💬WhatsApp
Must deliver a message fast and not lose it. So the design cares about delivery and many connections at once.
🎬Netflix
Must play video smoothly. So video is stored near viewers using a CDN.
🚕Uber / Ola
Must find the nearest driver quickly. So location data must update and be searched fast.
💳UPI payments
Must never lose or double a payment. So correctness comes before speed.
🛒Online shopping
Sale days bring big spikes. So the system adds servers when traffic rises.
🚆Train ticket booking
A rush starts the moment booking opens. So queues and extra capacity protect the system.
📝Note
See how the needs of the product shape the design. Different needs lead to different designs.

12Related Topics to Read Next

30 Must-Know Concepts→

A quick map of the ideas you will use in every design.

Scalability→

How a system grows with more users.

Availability→

How to keep the system up.

Reliability→

How to give correct answers even when parts fail.

What are Load Balancers?→

The first building block most systems add.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • ✔What: planning how the parts of a system fit together.
  • ✔Two levels: HLD (big picture) and LLD (inside one part).
  • ✔Building blocks: load balancer, servers, cache, database, queue, CDN.
  • ✔Qualities: scalability, availability, reliability, latency, consistency, cost.
  • ✔Steps: ask, list needs, estimate, draw, design data, go deep, find bottlenecks, explain trade-offs.
  • ✔Rule: start simple, then improve with numbers.
  • ✔Always: say your trade-offs out loud.
  • ✔One line: “System design is city planning for software.”
Next →
High-Level Design (HLD)