Scaling
Vertical Scaling
- Definition: Increasing resources (CPU, RAM, storage) of a single server.
- Pros: Simple setup and management.
- Cons: Expensive at higher tiers and limited by hardware capacity.
Horizontal Scaling
- Definition: Adding more servers or instances to handle load.
- Pros: Cheaper at scale, nearly unlimited resources.
- Cons: Requires coordination between instances and careful data consistency management.
Load Balancing
When using horizontal scaling, the system must decide which instance handles each user request.
Load balancing distributes incoming traffic across multiple servers.
Common Strategies
- Round Robin: Each request goes to the next server in turn.
- Least Connections: New requests go to the server with the fewest active connections.
- IP Hash: Requests from the same IP go to the same server for session consistency.
Cloud Auto Scaling
Cloud providers offer auto-scaling to manage scaling automatically.