liveBook · Manning

Horizontal scaling

As explained in Grokking Software Architecture

Increasing capacity by adding instances of a system component across multiple servers or processes.

When a coffee shop’s line gets too long, the owner can hire more baristas and direct customers to the next available register. Horizontal scaling, or scaling out, takes the same approach: add instances of a component across servers to handle more load. section 10.5.3

A load balancer directs incoming requests to available application servers. Adding servers increases capacity; if one fails, traffic can go to the remaining servers. By contrast, vertical scaling makes one server more powerful, but eventually reaches a physical ceiling. section 10.5.3 section 10.10

Figure 10.7 Scaling Up (Vertical) makes a single worker more powerful, but Scaling Out (Horizontal) offers a practically infinite, resilient scale by adding more identical workers.

Compare adding identical workers with making one worker more powerful. section 10.5.1

The disappearing shopping cart

Server A remembers a shopper’s cart locally. The next request lands on Server B, which knows nothing about it, so the cart appears empty. Move session state to an external data store or cache that every server can access; the application can still remember the cart without relying on a particular server. section 10.5.3

Keeping application servers stateless adds architectural work. Scaling also costs money, so choose capacity targets with the business: an internal HR tool for 500 employees may not need expensive infrastructure designed for a viral traffic spike. section 10.5.3 section 10.5.1

Scaling out can target a single busy component. For example, an inventory microservice can gain more instances without scaling the rest of the application. Document databases are also described as generally easier to scale horizontally than SQL databases, though their data-model tradeoffs still matter. section 12.2.2 section 8.2.2

How Grokking Software Architecture covers it

How deep it goes
Explains load balancing, server failure, and external session state, but stops short of deployment instructions.
Examples
Uses a coffee shop queue, a disappearing shopping cart, and a traffic-heavy inventory service.
What you can do after
Evaluate horizontal scaling against capacity needs, state-management complexity, resilience, and business cost.
How it connects
Connects horizontal scaling to load balancing, stateless servers, session caching, vertical scaling, and microservices.

Also explained in

Compare how 19 books explain horizontal scaling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.