← Back to Learn
Beginner17 April 20263 min read

Horizontal vs Vertical Scaling — Adding More Trucks vs a Bigger Truck

When your app can't handle the load, do you get a bigger server or more servers? Let's understand scaling with a delivery truck analogy.

scalingfundamentals
Share:

What is Scaling?

Imagine you run a delivery business with one truck that carries 100 packages. Business is booming and now you need to deliver 500 packages daily. You have two options:

Option A: Buy a BIGGER truck that carries 500 packages → Vertical Scaling

Option B: Buy 4 more trucks of the same size → Horizontal Scaling

Vertical Scaling (Scale Up)

Add more power to your existing server — more CPU, more RAM, faster SSD.

Before: 🖥️ (4 CPU, 8GB RAM)
After:  🖥️ (32 CPU, 128GB RAM)

Pros:

• Simple — no code changes needed
• No distributed system complexity
• Single point of management

Cons:

• There's a hardware limit (you can't buy a 10,000 CPU machine)
• Expensive at higher tiers (costs grow exponentially)
• Single point of failure — if this one server dies, everything dies
• Requires downtime to upgrade

Real example: Your PostgreSQL database is slow. You upgrade from 8GB RAM to 64GB RAM. Queries are faster now. Simple.

Horizontal Scaling (Scale Out)

Add more servers of the same size and distribute the load.

Before: 🖥️ (handles 1000 req/s)
After:  🖥️🖥️🖥️🖥️🖥️ (handles 5000 req/s)
         ↑
    Load Balancer distributes traffic

Pros:

• Virtually unlimited scaling (just add more servers)
• No single point of failure (one server dies, others continue)
• Cost-effective (use commodity hardware)
• No downtime to scale

Cons:

• Complex — need load balancers, distributed state management
• Data consistency challenges across servers
• Code must be stateless (sessions can't live on one server)
• More operational overhead

Real example: Netflix adds more servers during peak hours (Friday evenings) and removes them during off-peak. They scale from 1,000 to 10,000 servers dynamically.

When to Use Which?

Start with Vertical Scaling when:

• You're a startup with low traffic
• Your app is a monolith
• You need a quick fix
• Database is the bottleneck (databases are harder to scale horizontally)

Switch to Horizontal Scaling when:

• You've hit the vertical limit
• You need high availability (no single point of failure)
• Traffic is unpredictable (auto-scaling)
• You're building microservices

The Real-World Pattern

Most companies use BOTH:

Load Balancer
    ├── Server 1 (16 CPU, 32GB RAM) ← vertically scaled
    ├── Server 2 (16 CPU, 32GB RAM)
    ├── Server 3 (16 CPU, 32GB RAM)
    └── Server 4 (16 CPU, 32GB RAM) ← horizontally scaled

Each server is reasonably powerful (vertical), and there are multiple of them (horizontal). This is the sweet spot.

Key Takeaway

Vertical scaling is simple but limited. Horizontal scaling is complex but unlimited. In interviews, always mention that you'd start vertical for simplicity and move to horizontal as traffic grows. This shows practical thinking.

👨‍💻
Sahil Sudan

Software Engineer at Spense. I write about system design, web development, and fintech — explained simply for students and developers.

📬 Stay Updated

Get a new System Design or fintech insight every week. No spam, unsubscribe anytime.

Share: