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

High-Level Design (HLD)

The big picture: the main parts of a system, what each one does, and how data flows between them.

โฑ 13 min readBeginnerMust KnowInterview FavouriteHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

High-level design (HLD) is the big picture of a system: the main parts, what each one is for, and how data moves between them. It answers "what are the boxes, and how do they talk?" It does not answer "what are the class names?"

  • Contains: clients, load balancers, services, databases, caches, queues, storage, and the arrows between them.
  • Explains: why each part was chosen, how the system scales, and what happens when something fails.
  • Leaves out: classes, methods, and the code inside each box. That is low-level design.

02Concept: What is it?

A system is too big to hold in one head, so we draw it at different zoom levels. HLD is the zoomed-out view. You can see the whole city, the main roads and the bridges. You cannot see the furniture inside any house. Someone who has never seen the code should be able to read an HLD and explain how a request travels through the system.

A good HLD has five ingredients: the components (the boxes), the connections (the arrows, with a direction and a reason), the data (what is stored where), the numbers (how much traffic and data the picture must handle), and the decisions (why this and not something else).

The zoomed-out view
๐Ÿ‘คClientsweb, mobile
โ†’โ†“HTTPS
โš–๏ธLoad balancer
โ†’โ†“
๐Ÿ–ฅ๏ธApp serversthe business logic
โ†’โ†“
โšกCache
โ†’โ†“
๐Ÿ—„๏ธDatabase
Every box has one clear job. Every arrow means โ€œcallsโ€ or โ€œsends data toโ€.
๐Ÿง Boxes are jobs, not products
On an HLD you can write "cache" first and decide "Redis or Memcached" later. The shape of the system matters more than the brand names.

03Real-Life Example

๐ŸตThe City Map
Before building a city, planners draw a map: where the airport, the harbour, the main roads and the districts go, and which road links which. They do not draw the plumbing inside each house yet. The map lets everyone agree on the shape of the city, and spot problems ("all roads lead through one bridge") before any concrete is poured. The plumbing plan for a single building is the low-level design.
City map
High-level design
Airport, harbour, districts
Clients, services, databases
Roads between districts
Arrows: calls and data flows
One bridge everything crosses
A single point of failure
Traffic counts on each road
Capacity numbers (requests per second)
Why the harbour is on the east side
Design decisions and trade-offs
Planners and the council
Architects and the whole team
Plumbing plan for one house
Low-level design (one component)

04Why Do We Need It?

๐Ÿ—บ๏ธShared picture
Everyone agrees on the shape before anyone writes code. Fewer surprises later.
๐Ÿ”Find big mistakes early
A missing cache or a single database is cheap to fix on paper, and costly to fix in production.
๐ŸงฉSplit the work
Each team can take a box and its contract, and build in parallel.
๐Ÿ“ˆPlan for scale
The numbers on the picture show where the load lands, and what will break first.
๐Ÿ’ฌTalk to non-engineers
Managers and partners can follow a box-and-arrow picture. They cannot follow a class diagram.
๐ŸŽคPass interviews
Most โ€œDesign Xโ€ questions are HLD questions. A clear picture and a clear reason for each box is the answer.
HLD is where the expensive decisions are made, so it is where thinking is cheapest.

05Where Do We Use It?

๐Ÿ“„Design docs and RFCs
A proposal for a new system usually starts with an HLD and a list of alternatives.
๐ŸงพArchitecture decision records
Short notes saying โ€œwe chose X over Y because Zโ€, kept next to the HLD.
๐ŸŽคSystem design interviews
Almost all of the interview is spent on the high-level design and a few deep dives.
๐Ÿš€Project kick-off
Teams draw it before estimating work and splitting tasks.
๐Ÿ›ก๏ธSecurity and cost reviews
Reviewers look at the boxes and arrows to see where data goes and what it costs.
๐Ÿง‘โ€๐ŸซOnboarding
New engineers learn a system by reading its HLD before they read its code.

06Types / Parts / How It Works

What goes in an HLD

PartWhat it saysExample
ComponentsThe main building blocks and the job of eachLoad balancer, API service, cache, database, queue, search index
Data flowHow requests and data move. Show the read path and the write path separatelyWrite: client to API to database. Read: client to cache to database on a miss
Storage choicesWhich kind of store holds which data, and whyUser profiles in SQL, images in object storage, hot items in a cache
InterfacesThe APIs at the boundaries between boxes, not their internalsPOST /links, GET /{code}
Non-functional planHow the design meets scale, availability and consistency goalsThree replicas, two zones, eventual consistency for counters
Capacity numbersThe estimates the picture must handleAbout 400 writes per second, 40,000 reads per second
Deployment viewWhere it runs: regions and zonesTwo regions, active-active, a CDN in front
Failure planWhat happens when a box diesThe load balancer removes it, the replica takes over

Kinds of HLD diagrams

Pick the picture for the question
Block diagram
๐ŸงฑBoxes and arrowsthe main parts
The default picture
Data flow
๐Ÿ”€How data movesread path, write path
Arrows are the star
Sequence
โฑ๏ธOne flow over timewho calls whom, in order
For tricky flows
C4 model
๐Ÿ”ญLevels 1 and 2context, then containers
A named zoom ladder
A real HLD often uses two or three of these.

The C4 model is a popular way to zoom: level 1 (context) shows your system as one box among its users and other systems. Level 2 (containers) opens that box into the deployable parts, such as the web app, the API and the database. Levels 3 and 4 (components and code) belong to low-level design.

HLD vs LLD at a glance

High-level design (HLD)Low-level design (LLD)
QuestionWhat are the parts, and how do they connect?How is one part built inside?
ZoomThe whole systemOne component or module
ShowsServices, stores, queues, flowsClasses, interfaces, methods, patterns
DecidesTechnology, scale, availability, data placementStructure of code, responsibilities, extensibility
Typical authorArchitect or tech leadThe engineer who builds the component
Interviewโ€œDesign a URL shortener / chat appโ€โ€œDesign a parking lot / an elevatorโ€
๐Ÿ“Note
The next page, Low-Level Design (LLD), goes inside one box.
VisualizerBuild a URL-shortener design, one block at a timePick the main requirement, then switch building blocks on and off. Watch the picture and the read and write paths change, and see which blocks are missing or not needed, and why.
Design a URL shortener. What is the main requirement?

Most requests are redirects. A few popular links get most of the traffic, and a redirect must feel instant.

Pick the building blocks (app servers are always there)
๐Ÿ‘คUsers
โ†’โ†“
โš–๏ธLoad balancer
โ†’โ†“
๐Ÿ–ฅ๏ธApp servers
โ†“data layer
โšกCachemissing
โ†’โ†“
๐Ÿ—„๏ธDatabase
Read path: Users โ†’ Load balancer โ†’ App servers โ†’ Database
Write path: Users โ†’ Load balancer โ†’ App servers โ†’ Database
Needed blocks
2 / 3
covered
Missing
1
needed but absent
Not needed
0
added for no reason
Missing: Cache. Reads dominate and the same few links are hot. A cache answers most redirects without touching the database.
  • ๐ŸŒ CDN (optional): Redirect answers are tiny and can be cached at the edge. Helpful, but a deleted link must stop working, so it is not required.
  • โš–๏ธ Load balancer (good): Several app servers sit behind it, so one machine is not a single point of failure.
  • โšก Cache (missing): Reads dominate and the same few links are hot. A cache answers most redirects without touching the database.
  • ๐Ÿ—„๏ธ Database (good): The short code to long URL mapping must be stored durably.

A teaching model with fixed rules, not a rulebook. Real designs depend on the numbers: with different traffic, a different set of blocks could be the right answer. Always say why you added each box.

07How to Use It / Steps / Implementation

Drawing an HLD, step by step

  1. 1
    Start from requirements
    Write down what the system must do and how well (users, speed, uptime). Every box must serve one of them.
  2. 2
    Estimate the load
    Rough requests per second, data per day, read-to-write ratio. These numbers decide how many boxes you need.
  3. 3
    Define the interfaces
    List the few main operations at the edge, for example create link and open link. Keep them simple.
  4. 4
    Draw the simplest design that works
    Client, one service, one database. Do not start with 20 boxes.
  5. 5
    Trace the read path and the write path
    Follow one request from the user to the data and back, on each path. Add arrows with a label.
  6. 6
    Choose a store for each kind of data
    Pick by access pattern and size, not by fashion. Say why.
  7. 7
    Add boxes only when a number demands it
    Cache for hot reads, queue for bursts, replica for availability, CDN for distance.
  8. 8
    Walk through failures and growth
    Ask what happens when each box dies, and when traffic is 10 times bigger. Fix the weak spots.

Worked example: a URL shortener

Boxes, one write path and one read path
Write path: create a link
๐Ÿ‘คClient
โ†’โ†“POST /links
๐Ÿ–ฅ๏ธAPImakes a code
โ†’โ†“save
๐Ÿ—„๏ธDatabase
Read path: open a link
๐Ÿ‘คClient
โ†’โ†“GET /abc12
๐Ÿ–ฅ๏ธAPI
โ†’โ†“look up
โšกCachemiss: database
Assumptions (illustrative): 100 million new links a month, 100 redirects per new link.
  1. Numbers: 100 million per month is about 40 new links per second. At 100 reads each, that is about 4,000 redirects per second, and more at peak. Reads dominate.
  2. Decisions: a cache for hot links (reads dominate), a load balancer and several API servers (no single point of failure), a database for the code-to-URL mapping.
  3. Skipped on purpose: a queue and object storage. No bursts of writes, and no files to store.
  4. Failure plan: database replica for failover, and the cache can be rebuilt from the database.

A checklist for a good HLD

CheckAsk yourself
RequirementsCan I point to the requirement behind every box?
ComponentsDoes each box have one clear job and one clear name?
Data flowAre there labelled arrows, and both read and write paths?
DataIs it clear what is stored where, and why that store?
ScaleAre there numbers, and does each box handle them?
FailureWhat happens when each box dies? Is there a single point of failure?
Trade-offsCan I say what I gave up with each choice?

08Key Terms to Know

TermMeaning in easy words
High-level design (HLD)The big picture: main components and how they connect
Low-level design (LLD)The inside of one component: classes, interfaces and patterns
ComponentOne box with one job, such as a cache or a service
Data flowThe path data takes through the system
Read path / write pathThe route of a request that reads data, and one that changes it
Architecture diagramA drawing of the parts and their links
C4 modelA set of four zoom levels: context, containers, components, code
Design doc / RFCA written proposal that holds the HLD and the alternatives
ADRArchitecture decision record: a short note on one decision and its reasons
Single point of failureOne part whose failure stops the whole system
Non-functional requirementHow well the system must work: speed, uptime, scale

09Pros, Cons and Trade-offs

โœ… Pros
  • Finds large mistakes while they are cheap
  • Gives everyone one shared picture
  • Lets teams work in parallel on separate boxes
  • Easy for non-engineers to follow
  • Makes trade-offs visible and reviewable
โš ๏ธ Cons
  • Can hide hard details behind simple boxes
  • Goes out of date if nobody updates it
  • Too much upfront design wastes time
  • A pretty diagram can look right and still be wrong
  • Cannot prove the design works, only that it is plausible

Trade-offs

ChoiceWe gainWe lose
Detailed HLDFewer surprisesMore time before coding starts
Light sketchSpeed, room to learnGaps found late
Few big componentsSimple to run and reason aboutHarder to scale parts separately
Many small componentsIndependent scaling and teamsMore network calls and more to operate
Named technologiesConcrete and testableLocks in early, sometimes for fashion

10Common Problems and Mistakes

Common mistakes

  1. Too many boxes. Twenty boxes for ten users. Start simple, and add a box only when a number needs it.
  2. Buzzword soup. "Kafka, Redis, Kubernetes" with no reason. Every name must have a why.
  3. Arrows with no meaning. An arrow without direction or label hides what actually happens.
  4. No numbers. Without traffic and data sizes, you cannot say whether one database is enough.
  5. Only the happy path. No answer to "what if this box dies?"
  6. One path only. Showing the write path but not the read path (or the reverse).
  7. Mixing levels. Drawing classes and methods inside an architecture picture.

Things to watch

๐Ÿ•ณ๏ธHidden single points
One load balancer, one database or one queue can sink the whole picture.
๐Ÿ“‰Stale diagrams
Keep the HLD in the repository, and update it with big changes.
๐ŸงฎNumbers not matching
If the picture says one database and the numbers say 50,000 writes a second, one of them is wrong.
๐Ÿ”’Security left out
Show where users are authenticated and where sensitive data lives.

11Real-World Examples

๐Ÿ“„Engineering blogs
Companies publish HLDs of their systems: boxes for the edge, services, storage and pipelines.
๐ŸงฐOpen-source design docs
Many projects keep proposals (RFCs, enhancement proposals) with an architecture section and alternatives.
๐Ÿ—๏ธCloud reference architectures
Cloud providers publish standard diagrams for web apps, data pipelines and event systems.
๐ŸŽคInterview whiteboards
Candidates draw clients, a load balancer, services, a cache and a database, then explain each arrow.
๐Ÿ”ญC4 diagrams
Teams draw context and container diagrams for onboarding and reviews.
๐ŸงพDecision logs
Teams keep ADRs next to the diagram, so the reason for each choice outlives the people.
Mini case: finding a weak spot on paper
๐Ÿ–ฅ๏ธDraft HLDone database for everything
โ†’โ†“review: 50,000 reads/s
โš ๏ธSpot the limitone database cannot take it
โ†’โ†“add
โšกCache + replicasreads move off the primary
A review of the picture finds the problem before any code exists.

12Related Topics to Read Next

What is System Design?โ†’

The overview that introduces HLD and LLD.

Low-Level Design (LLD)โ†’

The next zoom level: the inside of one box.

Requirements Gatheringโ†’

Where every box on the picture comes from.

Back-of-the-Envelope Estimationโ†’

The numbers the picture must handle.

The 7-Step Interview Frameworkโ†’

Where HLD fits in a 45-minute interview.

What are Load Balancers?โ†’

The first box most designs add.

What is Caching?โ†’

The box that takes read load off the database.

Microservicesโ†’

How the boxes can be split into separate services.

Talking About Trade-offs and Bottlenecksโ†’

How to defend each choice on the picture.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • โœ”HLD: the whole system as boxes and arrows, with reasons.
  • โœ”Contains: components, data flow, storage, interfaces, numbers, failure plan.
  • โœ”Leaves out: classes and code. That is LLD.
  • โœ”Draw: the simplest working design first, then add boxes only for a number.
  • โœ”Always show: the read path and the write path.
  • โœ”Check: no single point of failure, and every box has a reason.
  • โœ”Interview: "Design X" questions are mostly HLD.
  • โœ”One line: โ€œDraw the map before you build the city, and say why each road is there.โ€
โ† Previous
What is System Design?
Next โ†’
Low-Level Design (LLD)