Horizontal Scaling
Horizontal scaling: distributing load across multiple machines.
Horizontal scaling means increasing system capacity by adding more machines or instances and distributing load across them. Horizontal scaling solves: Removes single point of failure Scales almost linearly Supports very large systems
Horizontal Scaling
CPU bottleneck = CPU time × RPS > CPU capacity Add more application servers Distribute traffic using load balancer Example: One server capacity = 200 RPS Traffic = 800 RPS Add 4 servers: Total capacity = 4 × 200 = 800 RPS
Horizontal Scaling for I/O Bottlenecks Add read replicas Add cache layer Add more app servers to spread I/O Example: One DB can handle 1,000 QPS Traffic needs 3,000 QPS Add 3 read replicas: Total read capacity ≈ 3,000 QPS
Horizontal Scaling for Memory Bottlenecks Partition cache across nodes Use distributed cache (Redis cluster) Shard in-memory data Example: Cache needed = 100 GB One machine RAM = 32 GB Use 4 cache nodes: Total cache ≈ 128 GB
Horizontal Scaling for Network Bottlenecks Network bottleneck happens when: One server NIC is saturated Horizontal scaling solution: Split traffic across multiple machines Example: One server NIC = 1 Gbps Traffic = 5 Gbps Add 5 servers: Each handles ≈ 1 Gbps
Horizontal Scaling for Database (System-Level) Horizontal DB scaling techniques: Read replicas (scale reads) Sharding (scale writes + data) Example: One DB primary: Max writes = 5,000 QPS Shard into 4 shards: Total writes ≈ 20,000 QPS
DISADVANTAGES Costs & Complexity Data consistency issues Hard debugging ADVANTAGES Better scalability High availability No hardware limit
8 vCPU 32 GB RAM 128 GB DISK