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.
Horizontal Scaling
Adding more servers to your pool of resources.
The Vertical Hard Limit
Why you can't scale Up forever
A single physical machine has immutable constraints. Even the most expensive server in the world has:
The Horizontal Shift
Moving from a single large server to a cluster of small ones introduces new complexities.
Load Balancing
You now need a way to distribute traffic across these multiple servers.
Statelessness
Servers can no longer store session data locally. You need a shared cache (Redis).
Comparison Table
| Feature | Vertical (Scale Up) | Horizontal (Scale Out) |
|---|---|---|
| Complexity | Low (One server) | High (Cluster management) |
| Data Consistency | High (Local memory) | Challenging (Distributed) |
| Limit | Hard Hardware Limit | Infinite (theoretically) |
| Availability | SPOF | Resilient (Multiple nodes) |
| Cost | Expontential (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.