What is horizontal scaling?

Horizontal scaling is the ability for an application to automatically scale by adding/reducing computing nodes as the workload increases/decreases. This is in contrast to vertical scaling, which means that you scale by adding more power (CPU, RAM) to an existing machine. Today, horizontal scaling is almost always more desirable than vertical scaling because you don’t get caught in a resource deficit. Instead of taking your server offline while you’re scaling up to a better one, or hoping that your vendor has correctly implemented hot upgrades, horizontal scaling lets you keep your existing pool of computing resources online while adding more to what you already have. When your app is scaled horizontally, you have the benefit of elasticity.

 

How horizontal scaling works

Horizontal scaling, also referred to as “scale out,” usually requires a load balancer, which is a middleware component in the standard three-tier client-server architectural model. The load balancer is responsible for distributing user requests (load) among the various back-end systems/machines/nodes in the cluster. Each of these back-end machines runs a copy of the software and therefore capable of servicing requests. It may also run a “health check” where the load balancer uses the “ping-echo” protocol or exchanges heartbeat messages with all the servers to ensure they are up and running.

 

Benefits of horizontal scaling

  • Ability to increase capacity on the fly
  • Limited, in theory, only by how many entities can be connected successfully
  • Easily scalable tools
  • Easier to run fault-tolerance
  • Easy to upgrade
  • Better use of smaller systems
  • Lower implementation cost compared to vertical scaling (scaling up)
  • Improved resilience due to the presence of discrete, multiple systems

 

Disadvantages of horizontal scaling

  • Complex architectural design
  • Licensing costs for additional servers
  • High utility costs (e.g., cooling and electricity)
  • Bigger footprint and impact on the data center
  • Extra networking equipment such as routers and switches are required

 

Suggested Reading and Related Topics

  • Vertical scaling: Contrast horizontal scaling with vertical scaling (or “scale up”).