# Horizontal and Vertical Scaling

Horizontal scaling changes the number of resource instances, while vertical scaling changes the capacity of an individual instance.

- Type: framework
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-10-19
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/horizontal-and-vertical-scaling/>)

## What it means

Horizontal scaling, or scaling out and in, adds or removes instances that share a workload. Vertical scaling, or scaling up and down, changes an instance’s resources, such as memory or CPU capacity. Either can be manual or automated; neither guarantees that the application or its dependencies can use the added capacity effectively.

## Why it matters

The choice affects cost, operational complexity, availability during changes, and the maximum workload a system can handle. A team needs to know whether its bottleneck is a resource ceiling or a design that prevents work from being distributed.

## When to use it

Use this comparison when a measured capacity constraint requires more resources. Vertical scaling can be simpler when a workload needs one larger node; horizontal scaling suits distributable work. Evaluate storage, sessions, consistency, and downstream limits before assuming instances can be added safely.

## How it works

1. Locate the bottleneck and identify the resource it consumes.
2. Check whether more capacity on one instance will relieve it.
3. Assess whether work and state can be distributed across instances.
4. Compare resizing interruption, provisioning delay, quotas, and ongoing costs.
5. Test both growth and safe capacity reduction under representative traffic.

## A practical example

A search service adds stateless workers horizontally during peak traffic. Its database initially scales vertically for more memory, because extra search workers cannot fix cache misses there. The team measures both layers rather than applying one scaling method everywhere.

## Where it breaks

Vertical scaling has hardware and service limits and may require interruption. Horizontal scaling introduces coordination, routing, and state-management problems. Scaling actions take time and can overload dependencies or lose unfinished work if scale-in is careless.

## Common mistakes

- Assuming more application instances increase database capacity.
- Treating horizontal scaling as automatically fault tolerant.
- Removing instances before their work is drained or safely transferred.

## Sources

1. [Autoscaling](<https://learn.microsoft.com/en-us/azure/architecture/best-practices/auto-scaling>) — Microsoft · Official documentation
2. [Scalability - Deploying Oracle SOA Suite 12c on AWS](<https://docs.aws.amazon.com/whitepapers/latest/deploying-oracle-soa-suite-12c/scalability.html>) — Amazon Web Services · Official documentation

## Related topics

- [Scalability](<https://wiki.soroush.uk/topic/scalability/>)
- [Load Balancer](<https://wiki.soroush.uk/topic/load-balancer/>)
- [Background Job](<https://wiki.soroush.uk/topic/background-job/>)
