Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
System Design topics
Lesson 2/ 31
Fundamentals & Networking

Scalability

Grow capacity smoothly as users, requests, and data scale by 10×–1000×.

BeginnerStateless · Scale-Out · Decoupled3 quiz questions0/4 subtopics done
Practice in AI HLD
In plain wordsDiagramTheorySubtopics (4)Step by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice
Deep-dive subtopics (4) - 0/4 completed
Vertical Scaling (Scale Up)

Increase capacity by upgrading a single machine with more CPU, RAM, and faster NVMe storage.

Beginner
Horizontal Scaling (Scale Out)

Add more commodity machines behind a load balancer so traffic and failures are shared.

Beginner
Stateless Architecture

Keep user state out of server RAM so any server instance can handle any request.

Beginner
Auto-Scaling & Read/Write Split

Automatically match server count to live traffic while separating heavy reads from writes.

Intermediate

In plain words

Scalability is how well a system copes when many more people start using it. You either make one machine bigger or add more machines that share the work.

Think of it like…

Vertical scaling is upgrading a delivery van to a semi-truck; horizontal scaling is adding a fleet of vans that share the route.

Where you’ve seen it

When a game launches and players jump from 10,000 to 1 million, the team adds more game servers behind a load balancer instead of buying one giant computer.

Words you’ll hear

Vertical scaling
Upgrading one machine with more CPU, RAM, or disk ("scale up").
Horizontal scaling
Adding more machines that share the load ("scale out").
Stateless
A server that keeps no user data in memory, so any server can handle any request.
Bottleneck
The slowest part of the system that limits everything else.

Visual diagram

Loading interactive diagram
Loading interactive exercise

Theory & deep dive

What scalability really means

Scalability is not just "having lots of servers." A truly scalable system keeps response times fast and costs predictable as users, data size, or requests grow 10× or 100×.

Every system eventually hits bottlenecks in one of three places: Compute (CPU/RAM), Storage (disk I/O and database locks), or Network (bandwidth and open connections). Fixing only one moves the bottleneck to the next.

Key takeaway: Adding 50 web servers does nothing if all 50 wait on one overloaded database.

The Golden Rule: Make the App Tier Stateless

If Server A stores a user’s shopping cart or login session in its own local RAM, then the user’s next request MUST land back on Server A - otherwise they look logged out. That makes auto-scaling and rolling deployments painful.

By moving sessions to Redis and uploaded files to S3/GCS, every web server becomes identical and disposable. If one dies or traffic doubles, a load balancer can send any user to any healthy server.

Real-world scaling progression

Day 1: 1 app server + 1 DB. Day 30: separate DB host + CDN. Day 180: stateless app fleet + Redis cache + read replicas. Year 2: async worker queues + database sharding.

Key takeaway: Externalize state (Redis for sessions, S3 for files) so web servers can be added or killed anytime.

Scaling reads vs. scaling writes

Reads are easy to scale: cache hot results in Redis, put static media on a CDN, and add database read replicas. Most apps are 90%+ reads, so this solves 90% of scale issues.

Writes are harder because data must stay consistent. You scale writes by moving heavy work off the critical path into queues (Kafka/SQS) and eventually splitting the database into shards.

How it works, step by step

Step 1 of 4
Single Server

1. Start with a single-tier baseline

Separate the web/app process from the database host first so compute and storage do not fight over the same CPU and RAM.

App Server → Dedicated Database
Key numbers at this step
Bottleneck
Shared RAM/CPU
Fix
Separate tiers

When to use it & trade-offs

What it is

Scalability is a system’s ability to handle increased load (traffic, data volume, or concurrency) without degrading latency or reliability.

Why it matters: A design that works for 1,000 users breaks when one server runs out of CPU, file descriptors, memory, or database connections.

When to reach for it

  • Designing stateless API tiers behind auto-scaling groups
  • Handling asymmetric read/write growth with caching + read replicas
  • Isolating bursty workloads (uploads, notifications) onto worker fleets

When to avoid or be careful

  • Adding microservices and sharding on day 1 before a bottleneck exists
  • Storing session state in local server RAM when running multiple instances
  • Scaling the web tier endlessly while all traffic still hits one un-indexed DB table

Vertical vs. Horizontal Scaling

Vertical Scaling (Scale Up)
Best for: Early growth, single-node DBs, simple ops

Strengths: No distributed complexity, no data partitioning, zero code changes.

Watch out: Hard hardware ceiling, expensive high-end SKUs, single point of failure.

Horizontal Scaling (Scale Out)
Best for: Stateless web tiers, high availability, global scale

Strengths: Virtually unlimited capacity, commodity hardware, natural redundancy.

Watch out: Requires load balancing, statelessness, and distributed state coordination.

Functional Partitioning
Best for: Large apps with uneven load across features

Strengths: Isolate heavy subsystems (search, auth, billing) so each scales independently.

Watch out: Introduces network calls and cross-service observability needs.

Interview signals & numbers to know

When this topic comes up

  • 10x traffic spike
  • millions of concurrent users
  • auto-scaling
  • stateless
  • bottleneck

Benchmarks & rules of thumb

User sessions -
Keep in Redis, not server RAM
Typical DB connection pool -
10–100 per app node
Read:Write ratio (social) -
10:1 to 100:1
Auto-scale spin-up time -
30–120s (VM) / <5s (container)

Common mistakes & follow-ups

Common interview mistakes

  • Scaling web servers horizontally without noticing the single DB becomes the bottleneck
  • Holding local in-memory state (uploads, sessions, cron locks) on stateless nodes
  • Skipping connection pooling (e.g., PgBouncer) when spinning up hundreds of app instances

Likely interviewer follow-ups

  • Where is the next bottleneck once your web tier scales to 500 instances?
  • How do you prevent connection exhaustion on PostgreSQL under auto-scaling?
  • How do you handle a sudden 10× traffic spike before auto-scaling finishes booting?
Interview tip: Walk through scaling in stages: stateless tier → CDN & cache → read replicas → async queues → sharding.

Knowledge check

Loading quiz

Put it into practice

Design full architectures with AI feedback

Apply Scalability inside real High-Level Design prompts or review Q&A flashcards.

Open AI HLD Practice →SD Interview Q&A
Previous topic
Back-of-the-Envelope Estimation
Next topic
DNS & Anycast Routing