Scaling: Vertical vs Horizontal
- Vertical (bigger machine): simple, no code changes; hard ceiling, single point of failure, expensive at the top end.
- Horizontal (more machines): near-linear scale and redundancy; requires stateless services (keep sessions in Redis/JWT, files in object storage) and a load balancer.
+--> [app 1] --+
client -> LB -+--> [app 2] --+--> cache --> DB primary --> replicas
+--> [app 3] --+
stateless app tier: any request can hit any server
Scale the stateless tier first (easy), then the data tier (hard: replication → caching → sharding).