Scalability

Lesson · Intern

Vertical vs horizontal scaling and why statelessness matters.

Vertical scaling

Give one machine more CPU, RAM or disk. Simple, no code changes, but has a hard ceiling, costs rise steeply and it remains a single point of failure.

Horizontal scaling

Add more machines behind a load balancer. Nearly unlimited growth and better fault tolerance, but you must handle data distribution, coordination and consistency.

Stateless services

If a server keeps no per-user state in memory, any server can handle any request, so you can add or remove servers freely. Push state into a shared store (database, cache) instead.