DevOps Blog - Nicolas Paris

Vertical scaling vs Horizontal scaling

DevOps

Beginner oriented post, this is a brief introduction of the difference between vertical and horizontal scaling and advantages on each one.

Vertical scaling

When you run out of CPU, RAM or disk, simply add more of them. It's the case for MySQL for example, if a 4 CPU is not enough anymore, add more CPU to it. This is easily done with cloud provider but might need a migration to other server for on-premises instances. This action to add more CPU or RAM to a resource is call vertical scaling. This maintenance does not ask for too many skills and can be done easily. Few downsides to consider because of the maintenance window asking for a downtime.

Horizontal scaling

Automatic scale up and down as the advantage to quickly respond at the volume request. Some application can have huge differences between office hours and closed, or the opposite have bigger request demand the evening or on special occasion like Black Fridays. Another use case is when someone influential talk about your application, your server would be on heavy load in less than few minutes, if you are down for these opportunities, it could be a missed huge boost. This is where the horizontal scaling is good for.

The horizontal scaling need knowledge and technic like load balancers, the entry skill level could be higher than simply add some CPUs. Code might need to be adapted to run at several places at the same time, for example files cannot be store in a container that could be destroyed. A user could be logged in a particular instance of your code and not the other one. The good part of this approach like Cloud Native application, mean you can make releases without downtime. This allows container orchestration like Kubernetes or Docker Swarm to scale as request grows without manual action. Cluster can scale up and down multiple time in hour.

Technics needed are so interesting that it's quickly tempting for a DevOps to overestimate the benefits of the horizontal scaling for a company.

Conclusion

Horizontal scaling as clear advantages but come with a cost. Knowledge and maintenance cost could be greater that the benefits of a simple vertical scale, depending on your understanding of cloud native application. There is no simple answer to that, and no single bullet. I use both in my day-to-day DevOps job.