Your application is slow under load. Two instincts compete. One says: buy a bigger server, with more cores and more RAM. The other says: add more servers behind a load balancer. These are vertical scaling (scale up) and horizontal scaling (scale out). Fashionable advice leans heavily towards the second. I think that is often premature, and I will argue for a specific order of operations after comparing them fairly.

Scaling up: what you get

The code does not change. A single process on a bigger machine uses its extra cores and memory, and data stays in one place, so there are no distributed transactions, no cache coherence puzzles, and no question about which node holds a user’s session. Operational burden stays flat: one thing to patch, back up and monitor. For a database in particular, scaling up is usually the first and best lever, because a single node can run joins and enforce constraints without network hops.

The downsides are real. Hardware has a ceiling, and the biggest cloud instances cost disproportionately more per unit of capacity than mid-sized ones. Resizing typically needs a restart, so you take downtime. And one machine is one failure domain: if it dies, everything on it is unavailable until it is replaced. Many programs do not use extra cores well either. A single-threaded process, or one bottlenecked on a lock, gains little from going from 8 to 64 cores. (Amdahl’s law states the limit: if 10 percent of the work is inherently serial, the maximum speed-up from any number of processors is 10 times.)

Scaling out: what you get

No hard ceiling: add nodes as load grows, and remove them when it falls. Autoscaling groups do this on a schedule or on metrics, which suits spiky demand such as a festival sale or the last day of a tax filing deadline. Losing one node out of ten is a 10 percent capacity reduction, not an outage. Rolling deployments become easy. Commodity machines are cheaper per unit.

The price is complexity, and it is paid mostly in code and design rather than in money.

  • State. If a server keeps a user’s session in its own memory, the next request landing on a different server finds nothing. Application servers must be stateless: sessions in a shared store such as Redis or in signed tokens, uploads in object storage, no local files that matter.
  • Coordination. Scheduled jobs that ran once on a single server now run on ten, unless you add leader election or a distributed lock. In-process caches diverge between nodes.
  • Shared dependencies. Ten app servers, each with a connection pool of 50, mean 500 connections hitting the database. The stateless tier scales out and the database becomes the bottleneck. Scaling out the data tier needs read replicas, partitioning or a different database, each with its own consistency trade-offs.
  • Observability. Debugging across ten nodes needs centralised logs and tracing that a single box did not.

A worked comparison

A ticket-booking site in Guwahati (invented) runs one application server and one database. Traffic doubles before a major concert sale. The team has two weeks.

LayerScale-up approachScale-out approach
App serverMove to a machine with double the cores; a restart at 3 a.m.Add three more behind a load balancer; needs sessions moved out of memory first
DatabaseLarger instance with more memory, so more of the working set is cachedAdd read replicas for browsing; writes still go to one primary

The app tier is best scaled out, once the session issue is fixed, since that fix is a few days of work and buys redundancy as well. The database is best scaled up first and given replicas for read-heavy traffic. Sharding it can wait until you have measured that one primary really cannot cope; that is a project measured in months and it changes how every query is written.

My position

Order of operations I would defend in a design review:

  1. Find the bottleneck before buying anything. Doubling application servers does nothing if one slow query holds all the time. Profile first.
  2. Build the application tier stateless from day one, even while running one server. It costs little at that stage and keeps scaling out open.
  3. Scale the data store up first. A single well-tuned primary on a large instance carries most businesses much further than people expect, and delays distributed-data complexity.
  4. Run at least two application nodes in production anyway. That is about availability, not capacity.
  5. Distribute the data layer only when measurements demand it, and pick the partition key with great care.

Where I would break this rule: workloads that are naturally parallel and bursty (batch processing, media encoding, request fan-out) are better scaled out from the start, and systems with strict uptime targets cannot tolerate a single large machine.

The deeper point is that “easy to scale out” is mostly a property of design, not of infrastructure. Statelessness, idempotent operations and externalised configuration make horizontal growth cheap. Without them, a pile of servers just becomes several copies of the same problem.

Figures and names in the examples are illustrative.

Leave a Reply

Trending