Vertical vs Horizontal Scaling
Lesson 13Beginner1h 14mAssessment-backed

Vertical vs Horizontal Scaling

Learn when to make one machine bigger, when to add more machines, and what scaling changes about state, cost, reliability, and operations.

What you will be able to do

Explain vertical and horizontal scaling in practical terms.
Identify when scale pressure comes from CPU, memory, I/O, database, network, or dependencies.
Understand why horizontal scaling usually requires stateless services and load balancing.
Connect scaling choices to AWS, GCP, Azure, Kubernetes, and autoscaling.
Avoid scaling before measuring the bottleneck.

Scaling means increasing a system's ability to handle load. The professional question is not how do we scale everything, but what exactly is saturated and what is the simplest safe way to relieve it.

Two Ways to Scale

Vertical scaling makes one machine bigger. Horizontal scaling adds more machines or instances. Vertical scaling is often simpler; horizontal scaling usually gives better availability and growth headroom but requires better architecture discipline.

Vertical scaling compared with horizontal scaling
Vertical scaling increases capacity of one node. Horizontal scaling distributes traffic across many nodes.
ApproachHow it worksUse whenRisk
Vertical scalingMore CPU, memory, disk, or network on one nodeEarly stage, simple bottleneck, database needs quick reliefHard limit, bigger failure blast radius, cost jumps.
Horizontal scalingAdd more instances behind routing/load balancingStateless services, read-heavy traffic, high availabilityRequires load balancing, deployment automation, shared state design.
Specialized scalingScale a bottleneck layer onlyDatabase, cache, workers, CDN, queue, search layer is saturatedWrong bottleneck diagnosis wastes money.

Scenario: Ticket Launch

A ticketing site launches concert tickets at 10 AM. Traffic jumps from 100 requests/sec to 20,000 requests/sec. Scaling the web server alone will not save the system if inventory locking, payment calls, or database writes are the actual bottleneck.

PressureSymptomScaling response
CPU on API serversHigh CPU, low dependency latencyAdd API instances or bigger instances.
Database writesSlow commits and lock waitsReduce write contention, queue non-critical work, partition carefully.
Hot product page readsSame page read repeatedlyCache page/data and use CDN.
Payment provider latencyThreads blocked waiting outside systemTimeouts, bulkheads, async confirmation where product allows.
Traffic spike fairnessSome clients overwhelm othersRate limiting, waiting room, queueing, backpressure.

Autoscaling Is Not Magic

Autoscaling reacts to signals such as CPU, memory, request count, queue depth, or custom metrics. It still needs safe deployments, warm-up time, capacity limits, and bottleneck-aware metrics.

SignalGood forCaution
CPUCPU-bound servicesMay miss database or network bottlenecks.
Request countWeb/API scalingNot all requests cost the same.
Queue depthWorker scalingNeeds max concurrency and DLQ monitoring.
MemoryMemory-heavy servicesMemory leaks can cause runaway scaling.
LatencyUser experience pressureScaling may not fix slow dependency.

Design principle

Scale the bottleneck, not the diagram. Measure saturation, identify the constrained resource, then choose the least complex scaling move that protects the user flow.

Cloud Scaling Mapping

NeedAWSGCPAzure
VM autoscalingEC2 Auto ScalingManaged Instance GroupsVirtual Machine Scale Sets
Container autoscalingECS Service Auto Scaling/EKS HPACloud Run autoscaling/GKE HPAContainer Apps scaling/AKS HPA
Serverless scalingLambda concurrencyCloud Functions/Cloud Run concurrencyAzure Functions scale controller
Database scalingRDS/Aurora read replicas, DynamoDB capacityCloud SQL replicas, Spanner, FirestoreAzure SQL replicas, Cosmos DB RU/s
Queue-based worker scalingSQS depth + ECS/LambdaPub/Sub/Cloud Tasks + Cloud RunService Bus + Functions/Container Apps

Beginner Mistakes

  • Scaling every service instead of finding the bottleneck.
  • Adding more API servers when the database is saturated.
  • Assuming autoscaling is instant.
  • Ignoring connection pools and dependency limits.
  • Scaling horizontally while keeping session state inside one server.

Guided Practice

Practice task

A course platform becomes slow during assessment submission. Name five possible bottlenecks and one metric that would confirm each.

Sample Answer

Possible bottleneckConfirming metric
API CPUHigh CPU and request queueing on API instances.
Database writesHigh write latency, lock wait, or connection saturation.
Scoring workerGrowing queue depth and oldest message age.
External plagiarism providerHigh dependency latency and timeout rate.
Cache/session storeHigh Redis latency or connection count.

Before You Continue

  • You should know vertical vs horizontal scaling.
  • You should identify bottlenecks before scaling.
  • You should understand autoscaling signals and limits.
  • You are ready to learn how load balancers distribute traffic across scaled services.