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
All topics/Scalability
FUNDAMENTALS & NETWORKING · SUBTOPIC

Horizontal Scaling (Scale Out)

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

BeginnerPart of Scalability
Practice in AI HLD
Subtopics in Scalability (4)
OverviewVertical ScalingHorizontal ScalingStateless TiersAuto-Scaling & R/W Split

In plain words

Instead of buying one super-expensive mega-computer, you run 20 normal computers side by side and put a traffic cop (load balancer) in front to split the work.

Think of it like…

Opening 10 normal checkout lanes at a supermarket instead of training 1 superhuman cashier.

Loading interactive diagram
Loading interactive exercise

Theory & how it works

Why cloud systems love horizontal scaling

Adding more identical machines gives you near-linear capacity growth using cheap commodity servers. If one node crashes, the load balancer stops sending traffic to it and the remaining 99% stay online.

You can also do zero-downtime rolling deployments: upgrade half the fleet while the other half keeps serving users.

The hidden costs of scaling out

Scaling out introduces network hops and distributed state. A load balancer must sit in front, servers must be stateless, and background jobs (like scheduled cron tasks) must not run 20 times in parallel without coordination.

If your database isn’t scaled too, 200 web servers opening 50 connections each = 10,000 connections, which will immediately crash PostgreSQL unless you use a connection pooler like PgBouncer.

Key takeaway: Horizontal scaling requires a load balancer, stateless servers, and database connection pooling.

Key points & practical guide

Summary checklist

  • Near-unlimited capacity by adding commodity nodes
  • Built-in fault tolerance: losing 1 of 10 nodes leaves 90% capacity intact
  • Requires stateless app servers and careful DB connection pooling

When to use it

  • Stateless web APIs and microservices
  • Any system requiring high availability (99.9%+) and zero-downtime deploys

Watch out for

  • Opening too many DB connections when scaling out app servers
  • Running duplicate cron jobs across every node without a distributed lock

Quick check

Loading quiz
Previous subtopic
Vertical Scaling (Scale Up)
Next subtopic
Stateless Architecture