Sub topic 4
Vertical scaling: a bigger machine
What this chapter assumes
You know what a client-server web application is. You know the four basic server resources: CPU, memory, disk, and network. You have a rough idea of what a web server and a database do. The previous chapters covered capacity, load, the three core metrics (latency, throughput, utilization), and how to find a bottleneck. This chapter assumes you have already found one.
What vertical scaling is
Vertical scaling, also called scaling up, means giving one machine more resources. You add CPU cores, memory, faster or larger disks, or more network bandwidth. You can also move the workload to a larger machine. The application still runs as a single instance, and clients still talk to a single address.
In a cloud environment this is usually a resize. You stop the instance, change its type from a small size to a larger one, and start it again. On physical hardware it means installing more RAM, a faster disk, or a better CPU.
Match the upgrade to the bottleneck
Adding resources only helps if you add the one that is scarce. Use the measurements from the earlier chapters to decide.
| Symptom you measured | Likely bottleneck | Vertical change that may help |
|---|---|---|
| CPU near 100%, latency rises with load | CPU | More cores or faster cores |
| Heavy swapping, out-of-memory kills | Memory | More RAM |
| High disk wait time, slow queries reading from disk | Disk | Faster storage (SSD or NVMe), more IOPS |
| Network interface saturated | Network | Higher bandwidth instance or NIC |
A common error is doubling everything because the system "feels slow". You pay for resources that sit idle, and the real bottleneck may remain.
Extra cores also help only if the software can use them. A single-threaded process uses one core no matter how many the machine has. A faster core helps it. More cores do not.
Why teams choose it first
Vertical scaling is often the cheapest change in engineering effort.
- No application changes. The code, configuration, and deployment stay the same.
- No distributed coordination. Data lives in one place, so there are no questions about consistency between copies.
- Simple operations. One machine to monitor, patch, and back up.
- Good fit for databases. A relational database on one node avoids the complexity of replication and sharding for as long as one node is enough.
For a system that is moderately loaded, a resize on a quiet afternoon can fix the problem in minutes.
Drawbacks
Vertical scaling has three main costs.
- Downtime during the change. Many resizes require a restart. Unless you have a standby, users see an outage.
- A single point of failure. One bigger machine is still one machine. If it fails, the whole service is down.
- Rising price per unit. Larger machines cost more per unit of capacity. Doubling the size often costs more than double, especially near the top of a vendor's range.
There is also a hard ceiling. The largest machine you can buy or rent sets the maximum capacity. The ceiling is covered in a later chapter.
A decision flow
The diagram shows the usual order of thinking. You scale up only after identifying the bottleneck, and you check that the ceiling and downtime are acceptable.
Worked example
A small web shop runs its application and database on one server with 4 cores and 16 GB of RAM. During sales, page latency climbs. Monitoring shows:
- CPU averages 35%.
- Memory use is at 98%, and the server is swapping to disk.
- Disk read wait time spikes during swaps.
CPU is not the problem. Memory is. The database cannot keep its working set in RAM, so it reads from disk. The team resizes to a machine with 4 cores and 64 GB of RAM. After the restart, swapping stops and latency returns to normal. They did not pay for extra cores they did not need.
After any resize, measure again. Confirm that the bottleneck moved or disappeared. Another resource often becomes the new limit.
Common errors
- Scaling up before measuring, then finding the problem was a slow query or a lock.
- Adding CPU to software that cannot use more than one core.
- Treating a bigger machine as a way to gain availability. It adds capacity, not redundancy.
- Forgetting that licensing can be priced per core, so a larger machine may raise software costs sharply.
Exercise
A single server shows 20% CPU, 40% memory use, and a network interface running at its full bandwidth. Latency rises as traffic grows. Would adding CPU cores and RAM be a sensible vertical change? What would be?
Show answer
No. CPU and memory have spare capacity, so more of them would not help. The bottleneck is network bandwidth. A sensible vertical change is moving to an instance type or network card with higher bandwidth. After the change, measure again to see whether another resource becomes the limit.
Exercise
Name two reasons a team might still choose vertical scaling for its database even though it creates a single point of failure.
Show answer
It needs no application changes and avoids the complexity of replication, sharding, and consistency between copies. Operations also stay simple, with one machine to monitor and back up. The team can pair it with a standby or backups to reduce the failure risk.