How to scale your app so you can handle higher load
Vertical Scaling
Get Resources with higher processor, more RAM, disk space.
Pros:
- Nothing changes about your infrastructure, easier to manage, and you don’t have to deal with Partition problem (see CAP Theorem) Cons:
- servers with higher storage/processing power can be a lot more expensive
- upper ceiling on the amount of CPU/RAM/disk space you can add in a single machine.
- available configuration usually is limited, meaning you may need only 10-20% more resources but the next available tier are 2x more resources for 2x cost.
- upgrade hardware components usually require a downtime
- SPOF
Horizontal Scaling
Adding more resources/nodes to distribute the workload.
Pros:
- “infinitely scalable” you can always add another machine
- Fault tolerance: in case of hardware failure/downtime, redundant servers can seamlessly take over
- on demand scalability: allow us to easily accommodate increasing load by adding more machine Cons:
- More complex:
- On the Web Tier require load balancing and proper management to ensure optimal distribution of load across nodes/machines
- On the Data tier:
- Require proper management such as sharding, replication, coordination (see Database Scaling and Reliability Strategies)
- Data Consistency concerns (see CAP Theorem)