Skip to content
We areTOP 1%

Why should application servers be stateless, and how do you make them stateless?

MediumConceptScalability & Performance
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

A stateless server keeps no client-specific data between requests, so any instance can serve any request. This lets you add or remove instances freely, route traffic with simple load balancing, and survive instance failures without losing user sessions.

  • Move state out: store sessions in a shared store such as Redis, or use signed tokens (for example, JWTs) that the client sends with every request.
  • Files and uploads go to object storage, not to the server's local disk.
  • Sticky sessions (pinning a user to one server) are a workaround that hurts load distribution and loses sessions when that server dies.
  • State still exists, but it is concentrated in databases and caches that are replicated and scaled deliberately.

More in Scalability & Performance

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account