Loading…
Loading…
Charting your lesson…
Opening your lesson…
Scalability — Vertical vs Horizontal
Lesson 1 of 4
6 steps•about 11 min•10 flashcards
Step 1/ 61 min
Every system design interview eventually asks "how would this handle 10x the traffic?" — and the first vocabulary you need is scaling. Getting vertical vs horizontal scaling crisp, and knowing why real systems almost always scale horizontally, sets you up for everything else in a design round: load balancers, sharding, and stateless services all follow from this one idea.
What this covers / why it matters: the two ways to scale, their trade-offs, and why horizontal scaling dominates modern architectures. It's the foundation the rest of the system-design chapter builds on.
Step 2/ 61 min
Modern web systems scale horizontally because it's cheaper (commodity machines), more resilient (no single point of failure), and effectively unbounded. But it demands statelessness: each request must be servable by any node, so you push session/state out of the app server into a shared store (Redis, a database). If a server holds user session in local memory, you can't freely add nodes — that's the number-one thing to fix before scaling out.
Vertical scaling still has its place: it's the fast first move (just resize the box) and it's often right for a single database primary that's hard to distribute. The mature answer in an interview is: "I'd scale vertically first as a quick win, but design the app to be stateless so I can scale horizontally behind a load balancer as the real long-term path — and I'd tackle the database separately, since that's usually the hardest thing to scale out."
Step 3/ 61 min
"Your web app is slowing down under load. How do you scale it?"
"First I'd figure out where the bottleneck is — app tier or database. If it's the app tier, the quickest fix is vertical: give the server more CPU and RAM. But that has a ceiling and leaves a single point of failure, so the durable fix is horizontal: run multiple app-server instances behind a load balancer. For that to work, the app must be stateless — so I'd move user sessions out of local memory into a shared store like Redis, and keep uploaded files in object storage rather than on the local disk. Then adding capacity is just adding nodes. The database is the harder part: I'd start with vertical scaling plus read replicas for read-heavy load, and only shard if a single primary genuinely can't keep up. So: vertical for a quick win, horizontal + stateless as the real answer, database handled separately."
Names both, justifies the choice, and flags statelessness and the database as the real constraints.
Step 4/ 61 min
Step 5/ 61 min
Proposing horizontal scaling while ignoring that the app stores session state in local memory. If any node can't serve any request, adding nodes breaks users' sessions. Always make the service stateless — externalise sessions and files — before claiming you can scale out.
Step 6/ 6· Worked examples1 min
Problem/Question: "Your single web server is overloaded as traffic grows. Explain vertical vs horizontal scaling and which you'd choose."
Solution/Model answer:
Vertical scaling (scale up): add more CPU/RAM/disk to the single machine.
Recall
Keep this
Scalability is how a system handles growing load. It is the foundation of every system-design interview: interviewers start small ("one server") and keep adding users until you must scale. Knowing the two directions to scale — and their limits — is table stakes.
| Vertical (scale up) | Horizontal (scale out) | |
|---|---|---|
| How | Bigger machine (more CPU/RAM) | More machines behind a load balancer |
| Limit | Hardware ceiling, single point of failure | Near-unlimited, but adds complexity |
| State | Easy (one box) | Needs statelessness / shared store |
| Cost | Cheap early, expensive at top | Linear, commodity hardware |
Real systems scale horizontally for the web/app tier and keep servers stateless (session in Redis/DB) so any request can hit any server.
Expected pattern: The starting point of nearly every system-design round; interviewers escalate load to force scaling decisions.
Quick recap: Vertical = bigger box (has a ceiling); horizontal = more boxes + load balancer + stateless servers. Scale the bottleneck.
You've read 0 of 6 steps
Now lock it in — questions straight after reading are what make it stick.