unfold_more

Vertical vs
Horizontal Scaling

Scaling up vs Scaling out. Every system starts with one machine, but none stay there.

Vertical vs Horizontal

Vertical Scaling

Adding more power (CPU, RAM) to an existing server.

"Buy a bigger box."

Horizontal Scaling

Adding more servers to your pool of resources.

"Buy more boxes."

The Vertical Hard Limit

block

Why you can't scale Up forever

A single physical machine has immutable constraints. Even the most expensive server in the world has:

CPU Socket LimitYou can only fit so many physical cores on a motherboard.
Memory BusThe speed of light and the size of the bus limit how fast RAM can talk to CPU.
Single Point of FailureOne hardware glitch takes down the entire system.

The Horizontal Shift

Moving from a single large server to a cluster of small ones introduces new complexities.

account_tree

Load Balancing

You now need a way to distribute traffic across these multiple servers.

settings_input_component

Statelessness

Servers can no longer store session data locally. You need a shared cache (Redis).

Comparison Table

FeatureVertical (Scale Up)Horizontal (Scale Out)
ComplexityLow (One server)High (Cluster management)
Data ConsistencyHigh (Local memory)Challenging (Distributed)
LimitHard Hardware LimitInfinite (theoretically)
AvailabilitySPOFResilient (Multiple nodes)
CostExpontential (High-end hardware)Linear (Commodity servers)

Interview Guidance

When to Scale Up?

Don't jump to horizontal immediately. If your traffic is low and predictable, vertical scaling is cheaper and simpler. It buys you time to focus on product without the overhead of distributed systems.

The Interview Pivot

In an interview, once you mention "We'll need to scale horizontally," be prepared to talk about **Load Balancers**, **Replication**, and **Sharding** immediately.