The Golden Question
When your website gets slow because too many users are visiting, you have two choices:
1. Vertical Scaling (Scale Up)
“Buy a bigger machine.”
- How: Add more RAM, more CPU, bigger SSDs to your existing server.
- Pros: Simple. No code changes needed.
- Cons: Expensive. Physical limits (a single stick of RAM can only be so big).
- Term: Also called “Scaling Up”.
2. Horizontal Scaling (Scale Out)
“Buy more machines.”
- How: Add more cheap servers alongside the first one.
- Pros: Infinite scale. Resilient (if one dies, others survive).
- Cons: Complex. Needs a Load Balancer.
- Term: Also called “Scaling Out”.
Interactive: The Scaling Game
Try to maximize your Capacity (how many users you can serve).
- Upgrade Server: Increases capacity of a single node (Vertical).
- Add Server: Adds a new node (Horizontal).
Server Nodes
1
Power per Node
1x
Total Capacity
100 users
The “Scale Cube”
Visualizing scalability as a 3D cube:
- X-Axis (Horizontal Duplication): The “Add Node” button you just clicked.
- Y-Axis (Functional Decomposition): Splitting “Monolith” into “Microservices”.
- Z-Axis (Data Partitioning): Sharding data.
[!IMPORTANT] Start Vertical. Don’t build microservices for 10 users. Scale Up until it hurts (power level 3), then Scale Out.