QamoosTech
Architecture & DesignData and stateIntermediate

Stateless vs Stateful

PronunciationSTAYT-les versuhs STAYT-ful

Definition

Stateless systems do not store client session data between requests, meaning every request must contain all necessary information. Stateful systems, however, remember previous interactions and store client state on the server across multiple requests.

Where you hear it

During system design discussions, scaling planning, and when choosing how to manage user sessions and API architecture.

Examples

  • We need to design a stateless API so any instance behind the load-balancer can handle the request.
  • Shopping carts are often stateful because the server must remember what items the user added across different pages.
  • Migrating from a stateful architecture to a stateless one made our application much easier to scale horizontally.

Common mistake

Assuming stateless means the application never saves data anywhere, when it actually means the server doesn't keep session memory about a specific client between independent HTTP requests.

Say it at work

  • In a meeting or chatLet us make sure the backend remains stateless so we can scale out easily without managing sticky sessions.
  • In an email or ticketPlease verify if this microservice requires a stateful approach or if we can handle the user session via a distributed cache.