Horizontal Scaling
Also known as: Scaling out, Scale-out
Increasing a system's capacity by adding more machines or instances that share the work, rather than making a single machine more powerful.
Horizontal scaling, also called scaling out, grows a system by adding nodes: more web servers behind a load balancer, more database replicas or more workers pulling jobs from a queue. Its counterpart, vertical scaling or scaling up, adds processors, memory or storage to an existing machine. Vertical scaling is simpler but eventually reaches the limits of the largest available hardware and leaves a single point of failure. Horizontal scaling can in principle keep growing as long as the workload can be divided, and it adds resilience because losing one node removes only part of the capacity.
Not every system scales out easily. The approach works best when components are stateless, keeping session data and files in shared services rather than on individual servers, a principle stressed by the Twelve-Factor App methodology. Data stores are harder: spreading a database across machines requires replication for reads and partitioning, or sharding, for writes, and introduces trade-offs between consistency and availability during network failures. Coordination overhead also grows with the number of nodes, so doubling the machines rarely doubles throughput exactly.
Cloud platforms made horizontal scaling routine by allowing instances to be created on demand and by offering autoscaling, which adds or removes capacity automatically in response to load. Container orchestrators such as Kubernetes apply the same idea to individual services. The architectural shift toward microservices is partly motivated by the wish to scale each part of a system independently. Horizontal scaling is not free: distributed systems are harder to debug and operate, and many workloads run comfortably on a single well-specified server for far longer than expected.
Key points
- Scaling out adds machines, while scaling up adds resources to a single machine.
- Stateless application design makes horizontal scaling much simpler.
- Databases scale out through replication and sharding, which introduce consistency trade-offs.
- Autoscaling in cloud platforms adds and removes instances automatically as load changes.
Related entries
Load Balancer
Device or software that distributes incoming network traffic across multiple servers to improve capacity, responsiveness and availability.
Microservices
Architectural style that builds an application as a suite of small, independently deployable services, each running its own process and owning its data.
Kubernetes
Open-source system for automating deployment, scaling and management of containerized applications across clusters of machines.
Cloud Computing
Delivery of computing resources such as servers, storage, databases and software over a network on demand, with users paying for what they use.
Twelve-Factor App
Methodology of twelve principles for building portable, scalable web applications and services, published by engineers at the cloud platform Heroku.
Database
Organized collection of structured data stored electronically and managed by software that lets users store, query and update it reliably.
High Availability
Design goal and set of techniques for keeping a system operational and accessible for an agreed, very high proportion of time.
Parallel Computing
Form of computation in which many calculations run simultaneously on multiple processors or cores to solve problems faster or at larger scale.
Referenced by
Other entries that discuss or point to Horizontal Scaling.