Repaso
EspaƱol
System DesignIntermediateSD-16

Why keep application servers stateless?

Options

  1. To save disk space on every application server
  2. Any instance can serve any request (easy scaling) (Correct option)
  3. Stateless servers are faster for CPU-heavy work
  4. To avoid using a database anywhere in the system

Answer

Any instance can handle any request, enabling autoscaling and easy failover; session state lives in a shared store or token

Why

If a server keeps user data in its own memory (like a login session), that user must always hit the same server, and if it restarts, the data is lost.

Stateless servers keep nothing between requests: sessions go to Redis or a signed token, files go to object storage (S3).

Then any server can handle any request, and you can add or remove servers freely.

Remember

Keep state out of app servers.

Key terms

Practice this question in Repaso