Horizontal vs vertical scaling

Vertical scaling (scale up) means making one machine bigger: more CPU, RAM, disk. Horizontal scaling (scale out) means adding more machines and distributing load across them (e.g. more app servers behind a load balancer).

Vertical: bigger machine

flowchart LR subgraph Before["Before"] B[1 server\n2 CPU, 4GB] end subgraph After["After (scale up)"] A[1 server\n8 CPU, 32GB] end Before --> After

Horizontal: more machines

flowchart TB LB[Load balancer] LB --> S1[Server 1] LB --> S2[Server 2] LB --> S3[Server 3]
AspectVerticalHorizontal
ChangeBigger single nodeAdd more nodes
LimitHardware ceiling, single point of failureTheoretical limit much higher
CostBig machines get expensiveCommodity boxes; pay for what you add
App designOften no code changeStateless app, shared storage/DB

Use vertical for quick gains and simple ops; use horizontal for long-term scale and availability. Most production systems scale out (horizontal) and use load balancing + shared DB/cache.