liveBook · Manning

Horizontal scaling

As explained in Fast by Default

Horizontal scaling is increasing system capacity by adding and distributing work across additional instances or nodes.

Horizontal scaling increases capacity by adding servers or nodes and distributing work across them, rather than making one server more powerful. It addresses scalability: how latency changes as concurrency and data volume grow. section 4.5.2 section 5.1

The central requirement is stateless application design: any request must be handleable by any server. Move sessions, uploads, and cached data out of local web-server memory and into shared storage. section 4.5.2

Apply horizontal scaling with these safeguards:

  • Store session state in cookies or a shared Redis instance instead of server memory, accepting the relevant latency and consistency trade-offs. section 4.5.2 section 4.5.6
  • Move file uploads and cached data to shared storage so requests remain interchangeable across servers. section 4.5.2
  • Test projected datasets at ten or one hundred times current size, inspect query indexes and N+1 patterns, and measure p50 and p99 latency under varying load. section 4.5.6 section 5.1
  • Add load shedding, rate limiting, cache expiration, cache size limits, and graceful degradation where traffic spikes or dependency failures could overwhelm the system. section 4.5.6 section 5.1

Choosing when to partition data

A single well-configured database may provide substantial headroom. Introduce sharding only when evidence shows that data volume exceeds one database's efficient capacity, then choose a partition key from actual access patterns; poor keys create imbalance or multi-shard scans. section 4.5.2

Service decomposition can let independently scaling components follow different demand patterns, but it adds substantial operational overhead. Decompose only when evidence shows genuinely different scaling needs; do not apply every scalability pattern preemptively. section 4.5.2

How Fast by Default covers it

How deep it goes
Explains statelessness, shared storage, sharding, audits, and load measurement, while deferring platform-specific implementation details.
Examples
Uses cookies, Redis, projected tenfold or hundredfold datasets, cache failures, load spikes, and database sharding decisions.
What it assumes
Assumes familiarity with servers, sessions, caches, databases, queries, and latency; teaches why local state blocks interchangeable request handling.
What you can do after
Evaluate scaling risks, externalize shared state, test projected load, and select decomposition or partitioning only when evidence supports it.
How it connects
Connects horizontal scaling to vertical scaling, stateless applications, shared storage, distributed caching, service decomposition, sharding, and resilience.

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 Fast by Default. The section links point to the parts of the book it draws on.