Skip to main content
Glossary

Horizontal Scaling

Adding more machines to distribute load, as opposed to vertical scaling which adds more power to a single machine.

Detailed Explanation

Horizontal scaling (scaling out) is the foundation of cloud-native architecture. Instead of upgrading a single server (vertical scaling), you add more servers and distribute the workload across them. This approach has no theoretical limit—you can always add more machines.

Horizontal scaling requires stateless services (no session data on the server), a load balancer to distribute traffic, and shared storage for persistent data. It provides fault tolerance (if one server fails, others continue), enables auto-scaling (add servers based on demand), and distributes geographic load (servers in multiple regions).

Why It Matters

Horizontal scaling enables unlimited growth, provides fault tolerance, and is the standard approach for cloud-native applications.

Real-World Example

When Black Friday traffic surges, an e-commerce platform auto-scales from 10 to 200 application servers. When traffic normalizes, it scales back to 10—paying only for what it uses.

When to Use

When you need to handle variable or growing traffic, require high availability, or want to distribute load geographically. Most cloud applications are designed for horizontal scaling from the start.

Advantages

  • No theoretical upper limit
  • Provides fault tolerance
  • Enables auto-scaling
  • Distributes geographic load
  • Uses commodity hardware cost-effectively

Disadvantages

  • Requires stateless application design
  • Adds load balancer complexity
  • Database scaling is separate challenge
  • Distributed system debugging is harder
  • Data consistency across servers requires care

Frequently Asked Questions

What is the difference between horizontal and vertical scaling?

Horizontal scaling adds more machines. Vertical scaling upgrades to a more powerful machine. Horizontal has no limit and provides fault tolerance but adds complexity. Vertical is simpler but has hardware limits and is a single point of failure.

How do I make my app horizontally scalable?

Key requirements: stateless services (no server-side session state), shared storage (database, Redis, S3), load balancer for traffic distribution, and environment-based configuration. Avoid storing state on the application server.

What is auto-scaling?

Auto-scaling automatically adds or removes servers based on metrics (CPU usage, request count, queue depth). Cloud providers (AWS Auto Scaling, GCP Managed Instance Groups) offer managed auto-scaling.

Can databases scale horizontally?

Yes, but it is complex. Options include read replicas (distribute reads), sharding (split data across servers), and distributed databases (CockroachDB, TiDB). Each approach has tradeoffs in consistency and complexity.

When is vertical scaling better?

For databases (vertical scaling is simpler than sharding), when simplicity matters more than scale, for initial development and testing, and for workloads that cannot be distributed across machines.

Back to Glossary

Browse all terms in our software development glossary.

Browse All Terms