What is the difference between vertical and horizontal scaling?
EasyConceptScalability & Performance
Answer
Vertical scaling (scaling up) adds more CPU, memory or disk to a single machine. Horizontal scaling (scaling out) adds more machines and spreads the load across them, usually behind a load balancer.
- Vertical: simple and needs no code changes, but it is limited by the largest available machine, becomes expensive at the top end, and leaves a single point of failure.
- Horizontal: capacity grows almost linearly and the system tolerates machine failures, but it needs stateless services, load balancing, and data partitioning or replication.
- In practice: start vertical because it is cheap and simple, then scale out the stateless tiers first; databases are the hardest tier to scale horizontally.