01. What is System Design?

Learning goals

By the end of this lesson you will be able to:

  • Explain system design in plain English to someone who has never built a large app
  • Distinguish coding, High-Level Design (HLD), and Low-Level Design (LLD) โ€” and know when each matters
  • Recognize the universal building blocks that appear in almost every production backend
  • Explain why "it worked on my laptop" is not enough at real-world scale
  • Name common trade-offs and describe what "good" system design looks like for a beginner

Simple definition (start here)

System design is the skill of planning how software components work together so a product:

  • Serves many users at once
  • Stores data safely and durably
  • Stays fast enough under load
  • Survives failures (crashes, network blips, traffic spikes)

The everyday analogy: opening a restaurant

Imagine you want to sell sandwiches:

StageWhat you're doingSoftware equivalent
CodingLearning how to slice bread and grill chickenWriting functions, classes, SQL queries
LLDDesigning the kitchen layout โ€” where the grill goes, how orders flow from counter to prep stationDesigning APIs, database tables, service modules
HLDDeciding: one food truck or ten locations? Do we need a central warehouse? How do customers order โ€” walk-in, app, delivery?Deciding: load balancers, caches, databases, CDN, queues

Writing a single function is like perfecting one recipe.
System design is like planning the whole restaurant chain so it doesn't collapse when 500 people show up at lunch.


Why system design matters

Small scale vs real-world scale

Small scale (school project, side app, 10 users):

  • One server
  • One database
  • Deploy on a Friday and hope for the best

That is fine. Many great products start exactly there.

Real-world scale (millions of users, global traffic, money on the line):

You must answer questions that never appear in a coding tutorial:

QuestionWhy it matters
Where do incoming requests go?One machine cannot handle everyone
Where is data stored โ€” and is there a backup?Hard drives fail; humans make mistakes
What if a server dies at 2 AM?Users expect the app to still work
What if users in India have slow internet?Latency is a product feature
How do we add a new feature without rewriting everything?Teams ship weekly, not yearly

System design is how you answer those questions before you paint yourself into a corner โ€” using diagrams, rough numbers, and explicit trade-offs.

Interview relevance (without being dry)

In a system design interview, the interviewer is not asking you to recite AWS service names. They want to see if you can:

  1. Clarify what you're building
  2. Estimate scale (roughly โ€” not to three decimal places)
  3. Draw a sensible architecture
  4. Discuss bottlenecks and failure modes
  5. Evolve the design when requirements change

That is the same skill you use when joining a team and someone says: "We need to handle 10ร— traffic next quarter."


Coding vs HLD vs LLD

Think of building a library:

LevelFocusLibrary analogySoftware example
CodingAlgorithms, syntax, data structures in one languageActually shelving a book, stamping a due dateImplement shortenUrl() in Python; write the SQL INSERT
LLD (Low-Level Design)Modules, classes, APIs, database schema, error handlingDetailed floor plan: shelf dimensions, checkout desk layout, barcode systemDesign UrlService class, urls table columns, POST /api/v1/urls request/response
HLD (High-Level Design)Major components, data flow, technology choices"We need a main branch, 3 reading rooms, a digital catalog, and an inter-library loan system"Client โ†’ Load Balancer โ†’ App Servers โ†’ Cache โ†’ Database โ†’ CDN

How to tell them apart in practice

ScenarioHLD or LLD?Why
"We use PostgreSQL for durable storage"HLDTechnology choice, not schema detail
"urls table has columns: id, short_code, long_url, created_at"LLDConcrete schema
"Traffic hits a load balancer, then app servers"HLDComponent layout
"GET /users/:id returns { id, name, email } or 404"LLDAPI contract
"Implement binary search on a sorted array"CodingAlgorithm in code

The building analogy (visual mental model)

You would never pour concrete before deciding how many floors the building has.
Similarly, don't obsess over column types before you know whether you need one database or ten.


A worked example: "Share a note" app

Let's design a tiny app where users paste text and get a shareable link.

Naive design (works for you and 3 friends)

What happens here:

  1. User opens the app in a browser
  2. Browser sends the note text to your server
  3. Server saves it in SQLite
  4. Server returns a link like myapp.com/note/abc123

This works! Ship it. Learn from real users.

When scale changes the design

Suppose the app goes viral. Now you have:

  • 50,000 users hitting the site at once
  • Large notes with images attached
  • Users worldwide (some far from your single US server)

Symptoms of pain:

SymptomRoot causeTypical fix
Pages load slowly in AsiaSingle server in VirginiaCDN + servers in multiple regions
App server CPU at 100%One machine handling all requestsLoad balancer + multiple app servers
Database overloaded on readsEvery page view hits the DBCache (Redis) for popular notes
Image uploads slow down APILarge files block request threadsObject storage (S3) + async upload
Server crash = site downSingle point of failureMultiple servers + health checks

Better design (works for many users)

Nothing magical happened. We introduced building blocks that appear in nearly every large system. You don't add them all on day one โ€” you add them when a bottleneck proves you need them.


The universal building blocks

Almost every large web application is a remix of these components:

#Building blockWhat it doesEveryday analogy
1ClientsBrowser, mobile app, IoT device โ€” initiates requestsThe customer placing an order
2DNSTranslates app.com โ†’ IP addressPhone book / address lookup โ€” deep dive: Lesson 05
3Load balancerSpreads traffic across many serversHost at a restaurant directing you to the next free table
4App / API serversBusiness logic, validation, orchestrationKitchen โ€” where the actual work happens
5CacheFast temporary storage (Redis, Memcached)The waiter who remembers "the usual" instead of asking the kitchen every time
6DatabaseDurable source of truthThe filing cabinet / ledger of record
7Queue + workersBackground jobs (email, thumbnails, reports)"We'll prep that catering order overnight"
8Object storage / CDNFiles, images, video; served from edge locationsWarehouse + local delivery hubs

How they fit together (typical read path)

You don't need everything on day one

StageReasonable stack
MVP / prototypeClient + 1 app server + 1 database
Early growthAdd cache for hot reads; CDN for static assets
Serious trafficLoad balancer + multiple app servers; queue for async work
Global scaleMulti-region, sharding, dedicated object storage

The art is knowing when to add complexity โ€” not adding it "just in case" on day one.


Why scale changes design (the highway analogy)

Imagine a two-lane road (your laptop):

  • Fine for 100 cars per hour
  • At 10,000 cars per hour โ†’ gridlock, accidents, angry drivers

You don't fix gridlock by buying a faster car. You:

  • Add more lanes (horizontal scaling โ€” more servers)
  • Add on-ramps and off-ramps (load balancers)
  • Add local exits so people don't drive cross-country for milk (CDN / edge caching)
  • Add a dispatch system for trucks that don't need the fast lane (queues for background work)

Key insight: Problems that don't exist at small scale dominate at large scale:

Small scaleLarge scale
"Is my query fast enough?""Can the database handle 50k reads/sec?"
"Did my deploy work?""Can we deploy without downtime?"
"One server is fine""What happens when any single machine dies?"
"Store the file on disk""Store 10 PB of user photos cost-effectively"

Functional vs non-functional requirements (preview)

You'll go deep on this in Lesson 02. For now:

TypeQuestion it answersExample
FunctionalWhat does the product do?"Users can shorten a URL and get redirected"
Non-functionalHow well does it do it?"Redirect latency p99 < 100ms"; "99.9% uptime"

Beginner trap: Designing only for features ("users can upload photos") while ignoring non-functionals ("upload must complete in < 5s on 3G", "photos must never be lost").

Interviewers and production systems care equally about both.


Trade-offs are the job

There is rarely one perfect design. A good system designer names trade-offs out loud instead of pretending one solution wins everything.

Common trade-offs

Trade-offOption AOption BWhen A winsWhen B wins
Speed vs costAggressive caching, bigger machinesMinimal infraUser experience is revenue-criticalEarly startup, tight budget
Consistency vs availabilityEvery read sees latest writeSystem stays up even if slightly staleBanking, inventorySocial media feed, view counts
Simplicity vs flexibilityMonolith, one databaseMicroservices, many storesSmall team, MVPLarge org, independent teams
Fresh data vs cached dataAlways hit databaseCache heavilyStock prices, auth tokensNews feed, product catalog
Build vs buyCustom solutionManaged service (RDS, S3)Unique competitive needStandard problem, speed to market

Worked example: caching a news feed

Without cache: Every user request hits the database โ†’ accurate, but slow and expensive at scale.

With cache: Most requests served from Redis in ~1ms โ†’ fast and cheap, but a just-posted article might not appear for a few seconds.

Neither is "wrong." The right answer depends on whether users need instant updates or fast loading.


What "good" looks like for a beginner

You do not need to:

  • Memorize Google's exact internal architecture
  • Name every AWS/GCP service on the first try
  • Design for billions of users on your first attempt

You do need to:

StepWhat good looks like
1. Clarify requirements"MVP is X; out of scope is Y; we expect Z users"
2. Rough estimates"~10M DAU โ†’ ~100 writes/sec peak โ†’ 1TB storage/year"
3. Clear HLDBoxes and arrows; major components labeled; data flow obvious
4. Key LLD detailImportant APIs, core tables, one or two sequence diagrams
5. Bottlenecks"Database writes will be the first bottleneck; here's why"
6. Failure modes"If cache dies, we degrade to DB โ€” slower but still up"
7. Evolution"At 10ร— traffic we'd add read replicas; at 100ร— we'd shard"

Red flags vs green flags in an interview

Red flag ๐ŸšฉGreen flag โœ…
Jumping straight to Kafka and microservicesStarting simple, evolving when needed
Never asking clarifying questionsSpending 5 minutes on requirements
"We'll just scale infinitely"Naming specific bottlenecks
Ignoring failure scenarios"If X dies, here's what happens"
Memorized buzzwords without reasoningExplaining why you chose each component

The system design process (bird's-eye view)

You'll learn each step in upcoming lessons. Here is the full arc:

LessonTopic
01 (this one)What is system design?
02Requirements gathering
03Back-of-the-envelope estimates
04Clients, servers, APIs
05Load balancing
06+Databases, caching, and beyond

Common beginner mistakes

MistakeWhy it's a problemBetter approach
Designing before clarifyingYou solve the wrong problem (full Instagram vs photo upload MVP)Spend 5โ€“10 minutes on requirements first
Only functional requirements"It has all the features" but it's slow, fragile, or expensiveAlways state latency, scale, availability
Over-engineering day one15 microservices for 100 usersMonolith + Postgres until pain proves otherwise
Under-engineering obvious bottlenecksSingle DB for 1M writes/secEstimate first; design for known hot paths
Treating diagrams as decorationBoxes with no data flowEvery arrow should mean something
Ignoring failure"It works when everything is healthy"Always ask: what if this component dies?
Buzzword salad"We'll use Kafka, Cassandra, and ML" without reasoningName the problem each tool solves

Check your understanding

Work through these before moving on. Try answering out loud โ€” that's closer to an interview.

Question 1

In one sentence, what is system design?

Question 2

Is designing a database table schema HLD or LLD? What about choosing "we'll use PostgreSQL"?

Question 3

Name four building blocks of a typical web backend and explain what each does in one line.

Question 4

Your side project works fine with one server. A blog post about it goes viral and traffic jumps 100ร—. Name two symptoms you might see and two building blocks you'd consider adding.

Question 5

A teammate says: "Let's use a cache so reads are fast." What's one trade-off you should mention?

Question 6

What's the difference between coding and system design? Use the restaurant or library analogy.

Detailed answers

1. What is system design?

System design is planning how software components work together under real-world constraints โ€” scale, latency, cost, and failures โ€” so the product remains useful, fast, and reliable as it grows.

2. HLD vs LLD for database decisions

  • Choosing PostgreSQL โ†’ HLD. It's a technology/component decision ("we need a relational database for durable storage").
  • Designing the urls table with columns id, short_code, long_url, created_at โ†’ LLD. It's concrete schema and field-level detail.

Rule of thumb: if you're naming components and flows, it's HLD; if you're naming APIs, tables, and classes, it's LLD.

3. Four building blocks (examples)

BlockOne-line explanation
Load balancerDistributes incoming requests across multiple app servers so no single machine is overwhelmed
Cache (Redis)Stores frequently accessed data in fast memory to reduce database load and latency
DatabasePersistent source of truth for data that must survive restarts
CDNServes static content (images, JS, CSS) from servers geographically close to users

Other valid answers: clients, DNS, queue/workers, object storage.

4. Viral traffic โ€” symptoms and fixes

Symptoms:

  • Slow page loads or timeouts (server CPU/memory maxed out)
  • Database connection errors or slow queries (too many concurrent reads/writes)
  • Server crash takes the whole site down (single point of failure)

Building blocks to add:

  • Load balancer + multiple app servers โ€” spread request load
  • Cache โ€” reduce database read pressure for hot data
  • CDN โ€” serve static assets without hitting your origin server

5. Cache trade-off

Caching trades freshness/consistency for speed and cost savings. After a write, cached data may be stale until the cache is updated or expires. You must decide whether slightly old data is acceptable (social feed: often yes) or not (bank balance: no).

6. Coding vs system design

Using the restaurant analogy: coding is learning to cook one dish perfectly. System design is planning the entire restaurant operation โ€” how many locations, how orders flow from customer to kitchen to delivery, what happens when the lunch rush hits, and how you expand without everything breaking.


Next: Requirements Gathering โ€” where you learn to ask the right questions before drawing a single box.