System Design
8. Load Balancing and ScalabilityAnimated
Stateless Architecture
Servers keep no per-user state between requests.
The idea
Each request carries what is needed, or state lives in a shared store, so any server can handle any request.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
No request depends on memory in a particular server.
- step:
- 1/4
- at:
- Client
1/11
The green dot is a request moving through the system.
Step by step
- 1Store sessions outside the server
- 2Each request is self-contained
- 3Any server can answer
- 4Servers are easy to replace
Where it is used
Scalable web tiers.
Watch out for
State must go somewhere reliable and fast.