System Design Visualized
Lesson 1.8

Stateless web tier

Play this lessonThis lesson comes with an interactive animation you can break, a live-code challenge and a chapter quiz.

To scale the web tier horizontally, we must move state (like user session data) out of the web servers.

🔒 Stateful server

Remembers client data from one request to the next. User A's session lives on Server 1, so every request from User A must go to Server 1. Load balancers can do this with sticky sessions, but adding or removing servers gets hard and failures lose sessions.

🔓 Stateless server

Keeps no client data. State lives in a shared data store (a relational database, Memcached/Redis, or NoSQL). Any server can handle any request. Simpler, more robust, more scalable.

Once the web tier is stateless, autoscaling is easy: add or remove servers automatically based on traffic.

Key takeaways

  • Keep the web tier stateless: store sessions in a shared store.
  • Stateless servers are interchangeable, which makes autoscaling possible.

Remember it, then prove it

Create a free account to save your progress, get spaced-repetition reviews of what you miss, and design real systems in the interview simulator.

Start free