SystemExpertsSystemExperts
Blogs

Patterns

35 items

Horizontal Scaling Pattern

15mbeginner

Retry with Backoff Pattern

15mbeginner

Replication Pattern

25mintermediate

Caching Strategies Pattern

25mintermediate

Persistent Connections Pattern

20mintermediate

Load Balancing Pattern

20mintermediate

Fan-out Pattern

20mintermediate

Fan-in Pattern

20mintermediate

Circuit Breaker Pattern

20mintermediate

Eventual Consistency Pattern

25mintermediate

Queue-based Load Leveling Pattern

20mintermediate

Bloom Filters Pattern

20mintermediate

Time-Series Storage Pattern

20mintermediate

Bulkhead Pattern

20mintermediate

Batch Processing Pattern

20mintermediate

Write-Ahead Log Pattern

20mintermediate

API Gateway Pattern

20mintermediate

Backend for Frontend Pattern

20mintermediate

Sidecar Pattern

20mintermediate

Idempotency Pattern

20mintermediate

Rate Limiting Pattern

20mintermediate

Backpressure Pattern

20mintermediate

Pub/Sub Pattern

25mintermediate

Strong Consistency Pattern

30madvanced

Conflict Resolution Pattern

25madvanced

Leader Election Pattern

25madvanced

Consensus Protocols Pattern

30madvanced

CQRS Pattern

28madvanced

LSM Trees Pattern

25madvanced

Sharding Pattern

25madvanced

Event Sourcing Pattern

30madvanced

Stream Processing Pattern

25madvanced

Change Data Capture Pattern

25madvanced

Distributed Locking Pattern

25madvanced

Two-Phase Commit Pattern

25madvanced
System Design Pattern
Scalabilityhorizontal-scalingscale-outstatelessload-balancingelasticitybeginner

Horizontal Scaling Pattern

Adding more machines to handle increased load

Used in: Web Servers, API Services, Microservices|15 min read

Summary

Horizontal scaling (scaling out) adds more machines to handle increased load, as opposed to vertical scaling (scaling up) which upgrades a single machine. Adding servers multiplies capacity: 10 servers handle 10x the load of one server. This pattern enables theoretically unlimited scaling and eliminates single points of failure. However, it requires stateless application design, distributed data management, and load balancing. Horizontal scaling is how modern systems handle millions of users - Netflix runs thousands of instances, Google has millions of servers. The key insight is designing for horizontal scaling from the start is much easier than retrofitting later.

Key Takeaways

Linear Capacity Growth

Adding servers increases capacity proportionally. 10 servers = 10x capacity. Unlike vertical scaling which has diminishing returns and hard limits, horizontal scaling can grow indefinitely.

Stateless Services Required

For horizontal scaling, any server must handle any request. This requires stateless design - no local session state. Store state in external systems (Redis, database).

Automatic Scaling

Cloud platforms enable auto-scaling based on metrics (CPU, request rate). Scale out during peak, scale in during quiet periods. Pay only for what you use.

Vertical Scaling (Scale Up): - Upgrade to bigger machine - More CPU, RAM, faster disk - Simple - no architecture changes - Has hard limits (biggest available machine) - Single point of failure

Horizontal Scaling (Scale Out): - Add more machines - Distribute load across fleet - Requires distributed architecture - No theoretical limit - Built-in redundancy

Scaling Approaches

Summary

Horizontal scaling (scaling out) adds more machines to handle increased load, as opposed to vertical scaling (scaling up) which upgrades a single machine. Adding servers multiplies capacity: 10 servers handle 10x the load of one server. This pattern enables theoretically unlimited scaling and eliminates single points of failure. However, it requires stateless application design, distributed data management, and load balancing. Horizontal scaling is how modern systems handle millions of users - Netflix runs thousands of instances, Google has millions of servers. The key insight is designing for horizontal scaling from the start is much easier than retrofitting later.

Key Takeaways

Linear Capacity Growth

Adding servers increases capacity proportionally. 10 servers = 10x capacity. Unlike vertical scaling which has diminishing returns and hard limits, horizontal scaling can grow indefinitely.

Stateless Services Required

For horizontal scaling, any server must handle any request. This requires stateless design - no local session state. Store state in external systems (Redis, database).

Automatic Scaling

Cloud platforms enable auto-scaling based on metrics (CPU, request rate). Scale out during peak, scale in during quiet periods. Pay only for what you use.

Failure Isolation

One server failure affects only fraction of traffic. With 10 servers, one failure loses 10% capacity. System continues operating. Compare to vertical: single server failure is total outage.

Complexity Trade-off

Horizontal scaling adds complexity: load balancing, distributed state, service discovery, deployment coordination. Worth it at scale, overkill for small apps.

Data Layer is the Challenge

Scaling stateless compute is easy. Scaling databases is hard. You can add 100 API servers easily, but database becomes bottleneck. Need sharding, read replicas, caching.

Pattern Details

Vertical Scaling (Scale Up): - Upgrade to bigger machine - More CPU, RAM, faster disk - Simple - no architecture changes - Has hard limits (biggest available machine) - Single point of failure

Horizontal Scaling (Scale Out): - Add more machines - Distribute load across fleet - Requires distributed architecture - No theoretical limit - Built-in redundancy

Scaling Approaches

Trade-offs

AspectAdvantageDisadvantage

Premium Content

Sign in to access this content or upgrade for full access.