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


















