Scaling: vertical vs horizontal
Verdict: Make one instance bigger with more CPU and RAM, vertical scaling (scale up). Add or remove identical instances, horizontal scaling (scale out and in).
| Criterion | Vertical scaling | Horizontal scaling |
|---|---|---|
| Changes | The size of one instance | The number of instances |
| Also called | Scale up or down | Scale out or in |
| Example | Resize a VM to a bigger tier | Add more identical web servers during a spike |
Rules
- Vertical scaling increases or decreases the capabilities of one resource, for example adding CPU and RAM to a single virtual machine.
- Horizontal scaling adjusts the number of resources by adding or removing identical instances rather than resizing one.
- Automatically adding identical instances for a spike and removing them afterwards is horizontal scaling: scale out then scale in.
Traps
- Adding CPU and RAM to one server is vertical scaling, not horizontal, which changes the instance count.
- Enlarging a single server for a spike is scaling up, not the horizontal add-and-remove of identical servers.