Horizontal Scaling

Overview

Horizontal scaling increases capacity by adding more service instances rather than increasing the size of a single machine.

How It Works

flowchart LR U[Users] --> L[Load Balancer] L --> I1[Instance 1] L --> I2[Instance 2] L --> I3[Instance 3]

Production Example

A traffic surge during a product launch is handled with autoscaling.

apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: web-api-hpa spec: minReplicas: 3 maxReplicas: 20 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 65

Design Requirements

Common Pitfalls

Key Takeaways