Video in progress
What is the difference between vertical scaling and horizontal scaling?
Vertical scaling means making one server more powerful (more CPU, RAM). Horizontal scaling means running several identical servers and splitting the load between them.
📖 Answer
Vertical scaling is simple: you don't change the code, you just move the server to a bigger plan. But it has a ceiling — there is no machine bigger than the biggest one, and the price doesn't grow linearly, it climbs fast. And with a single server, when it goes down, everything goes down.
With horizontal scaling, 2, 5 or 50 copies run with a load balancer in front. If one copy dies, the rest keep working. The catch is that the application has to be stateless: sessions, uploaded files and local caches must not live only in one server's memory.
In practice you usually mix both. You scale the application servers horizontally, and scale the database vertically for a long time, because splitting a database (sharding) is much harder.
Sign up to mark studied questions and save your progress.