system-design · beginner

Vertical vs Horizontal Scaling — Bigger Machine or More Machines?

Start here

When load grows, you can scale in two basic ways:

  1. Vertical scaling (scale up): give one server more CPU, RAM, disk, or a bigger VM size.
  2. Horizontal scaling (scale out): run more servers and split work among them.
You should care because interviews and production capacity planning both hinge on this choice. Vertical is simple until you hit hardware/cloud size limits or single-host failure risk. Horizontal enables huge scale but needs statelessness, load balancing, and often sharding.

What you will learn

  1. Define vertical and horizontal scaling clearly.
  2. See when each is appropriate.
  3. Connect horizontal scale to load balancers and data partitioning.
  4. Work a complete API tier example.
  5. Discuss databases: vertical first, then replicas/shards.
  6. Avoid “always microservices = horizontal.”

What you should know first

TopicWhy
ScalabilityGoals of scaling
Load balancingHorizontal app tier
System design foundationsRequest path pieces

Words you need before we begin

TermPlain English
Scale upVertical: bigger box.
Scale outHorizontal: more boxes.
Stateless serviceAny instance can handle any request without local sticky memory.
Sticky sessionForcing a user to one instance—hurts horizontal flexibility.
ShardHorizontal split of data by key.
ReplicaCopy of data for reads/HA.
Diminishing returnsBigger machines get pricey/slow to grow.

Simple story: cafe capacity

One giant kitchen still burns down as one fire (SPOF). Many locations need coordination.

The problem of only vertical thinking

“Just buy a bigger database.” Eventually:

Step-by-step explanation

Step 1 — Measure the bottleneck

CPU, memory, disk IO, network, or lock contention? Scaling the wrong dimension wastes money.

Step 2 — Try simple vertical for early stages

Often the best ROI before architecture rewrites.

Step 3 — Make app tier horizontally scalable

Step 4 — Scale reads on data

Replicas, caches—before complex write sharding.

Step 5 — Scale writes when needed

Sharding/partitioning; accept operational cost.

Step 6 — Automate

Autoscaling policies from CPU/RPS/lag—not vibes.

Step 7 — Re-evaluate cost

Sometimes a larger vertical DB + cache beats premature shards for a given company stage.

Visual mental model

flowchart TB
  subgraph v [Vertical]
    C1[Client] --> Big[One big server]
  end
  subgraph h [Horizontal]
    C2[Client] --> LB[Load balancer]
    LB --> S1[Server]
    LB --> S2[Server]
    LB --> S3[Server]
  end

Learning question: Which design survives one server disk death more gracefully?

Caption: Horizontal with redundancy—if data is also replicated.

Complete worked example: growing API

Starting situation

Monolith API on one VM at 70% CPU peak. Product expects 5× traffic in a year.

Phase 1 vertical

Move to larger VM; add better DB plan. Ships in days.

Phase 2 horizontal app

Containerize API; 3+ replicas; Redis sessions; LB. Deploy without downtime.

Phase 3 data

Read replicas for reporting; cache hot GETs; plan shard only if write IO saturates primary.

Failures discussed

How it works in production

Failure modes

ModeImpactMitigation
Vertical ceilingCannot growHorizontal strategy
Stateful app instancesBad balancingExternalize state
Autoscale thrashInstabilityCooldowns, correct metrics
Premature shardingComplexity outageEvidence-based triggers
Ignoring data tierApp scales, DB meltsMeasure end-to-end

Trade-offs

ApproachProsCons
VerticalSimple opsLimits, SPOF, cost curve
HorizontalScale & HA potentialCoordination complexity
HybridPragmaticNeed clear playbook

Compare with related concepts

ConceptNotes
ScalabilityGoal; vertical/horizontal are strategies
ElasticityAuto add/remove capacity
Performance optimizationSometimes better than more machines

Common misunderstandings

  1. “Horizontal is always better.” Not at five users.
  2. “Vertical is obsolete.” Still primary tool for many DBs early.
  3. “More pods fix lock contention.” App locks may worsen.
  4. “Microservices required to scale out.” A modular monolith can scale horizontally.
  5. “Autoscaling replaces capacity planning.” Dependencies still saturate.

Check your understanding

  1. Define scale up vs scale out.
  2. Why statelessness matters for horizontal apps?
  3. When scale a database vertically first?
  4. Name a risk of premature sharding.
  5. What should you measure before scaling?

Practice

  1. Design a two-phase plan for a read-heavy blog.
  2. Estimate cost: one huge VM vs four smaller ones (qualitative).
  3. List stateful features that block scale-out.
  4. Choose autoscale signals for API vs queue workers.
  5. Explain SPOF differences with diagrams.

Deeper production notes

Connection pools

Horizontal app tiers multiply DB connections. Pool sizes × pods can knock over databases—coordinate.

Noisy neighbors

In multi-tenant horizontal systems, isolate heavy tenants so scale-out for one does not tax others unfairly.

Additional teaching scenarios

Scenario A — peak load day

Traffic multiplies by ten. Mark which failure modes appear first and the first mitigation for each.

Scenario B — mixed versions

Half the fleet runs an old build. Which assumptions break? Prefer one deploy window of compatibility.

Scenario C — five-sentence teach-back

Explain the core idea without acronyms.

Scenario D — metrics and alerts

List three metrics and one alert tied to user impact or scarce resources.

Scenario E — non-goals

Name two problems this technique should not solve.

Scenario F — ownership

Who owns dashboards, code, and pages?

Revision summary

Glossary

TermDefinition
Vertical scalingAdding resources to one node.
Horizontal scalingAdding nodes.
Stateless serviceNo required local session affinity.

Abbreviations and terminology

What to learn next

  1. Scalability
  2. Load balancing
  3. Database sharding
  4. Microservices architecture

Extra teaching notes for first-time builders

Write the single bottleneck you are protecting before picking tools. Name the signal that tells you the design is working for users, not only that internal counters move. When reviewing a change related to this lesson, ask what happens when the component is slow for ten minutes, down entirely, or running twice. Prefer small explicit failure modes that operators can understand at 3 a.m.

Document ownership for dashboards, code, and pages. Undocumented mechanisms become folklore and then outages. Prefer designs that tolerate mixed versions for at least one deploy window so rollouts do not require perfect global simultaneity.

Napkin math helps: estimate peak rate, multiply by payload size, and ask whether the design still holds when a dependency is at half capacity. If the answer depends on luck, add bounds, backpressure, or shedding before production traffic arrives.

Extra teaching notes for first-time builders

Write the single bottleneck you are protecting before picking tools. Name the signal that tells you the design is working for users, not only that internal counters move. When reviewing a change related to this lesson, ask what happens when the component is slow for ten minutes, down entirely, or running twice. Prefer small explicit failure modes that operators can understand at 3 a.m.

Document ownership for dashboards, code, and pages. Undocumented mechanisms become folklore and then outages. Prefer designs that tolerate mixed versions for at least one deploy window so rollouts do not require perfect global simultaneity.

Napkin math helps: estimate peak rate, multiply by payload size, and ask whether the design still holds when a dependency is at half capacity. If the answer depends on luck, add bounds, backpressure, or shedding before production traffic arrives.

Extra teaching notes for first-time builders

Write the single bottleneck you are protecting before picking tools. Name the signal that tells you the design is working for users, not only that internal counters move. When reviewing a change related to this lesson, ask what happens when the component is slow for ten minutes, down entirely, or running twice. Prefer small explicit failure modes that operators can understand at 3 a.m.

Document ownership for dashboards, code, and pages. Undocumented mechanisms become folklore and then outages. Prefer designs that tolerate mixed versions for at least one deploy window so rollouts do not require perfect global simultaneity.

Napkin math helps: estimate peak rate, multiply by payload size, and ask whether the design still holds when a dependency is at half capacity. If the answer depends on luck, add bounds, backpressure, or shedding before production traffic arrives.

Extra teaching notes for first-time builders

Write the single bottleneck you are protecting before picking tools. Name the signal that tells you the design is working for users, not only that internal counters move. When reviewing a change related to this lesson, ask what happens when the component is slow for ten minutes, down entirely, or running twice. Prefer small explicit failure modes that operators can understand at 3 a.m.

Document ownership for dashboards, code, and pages. Undocumented mechanisms become folklore and then outages. Prefer designs that tolerate mixed versions for at least one deploy window so rollouts do not require perfect global simultaneity.

Napkin math helps: estimate peak rate, multiply by payload size, and ask whether the design still holds when a dependency is at half capacity. If the answer depends on luck, add bounds, backpressure, or shedding before production traffic arrives.

FAQ from first-time learners

Q: Can I do both?
A: Yes—larger nodes and more of them is common.

Q: Is serverless horizontal?
A: Platforms scale out invocations for you, with different limits.

Q: Does horizontal always improve availability?
A: Only with redundancy and healthy data replication—not merely more app pods on one database.

Track: Software Design and Architecture

Previous: Sync vs Async Communication — Wait or Don’t Wait

By Shubham Jain

All articles · Study paths

Shubham Jain · Learning Lab