← Lessons

quiz vs the machine

Silver1100

System Design

Stateless Service Design

Push session and request state out of the process so any node can serve any request.

4 min read · intro · beat Silver to climb

What stateless means

A stateless service keeps no client specific data between requests inside the process. Everything needed to handle a request arrives in the request or is fetched from a shared store.

Why it matters

  • Interchangeable nodes: a load balancer can send a request to any instance because none holds special memory of the client.
  • Easy scaling: add or remove instances freely, since no node owns a user.
  • Fast recovery: a crashed node loses nothing important because state lives elsewhere.

Where the state goes

  • Session stores like Redis hold login and cart data keyed by a token.
  • Databases hold durable records.
  • Tokens such as signed cookies carry small state with the client itself.

Common traps

  • Sticky sessions pin a user to one node and quietly reintroduce state, hurting failover.
  • In memory caches that are not shared cause inconsistent answers across nodes.

Key idea

A stateless service externalizes all client state, so every instance is interchangeable and the system scales and recovers by simply adding or replacing nodes.

Check yourself

Answer to earn rating on the learn ladder.

1. What defines a stateless service?

2. Why are sticky sessions a warning sign in a stateless design?