Skip to content
StackDecode
System Design
8. Load Balancing and ScalabilityAnimated

Stateful Architecture

Servers hold state between requests.

The idea

Stateful servers keep sessions or data in memory, which is fast but ties users to servers.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ClientLoad balancerServer A (sessi…Server B (sessi…
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

The server keeps per-user state in its own memory.

step:
1/4
at:
Client
1/9

The green dot is a request moving through the system.

Step by step

  1. 1Server stores user state
  2. 2Requests must return to it
  3. 3If it fails the state is lost
  4. 4Replicate state if needed

Where it is used

Databases and game servers.

Watch out for

Scaling and failover are harder.

Related