Stateful vs Stateless Application

State – It is the session data that is been generated at the time of a client connects to a server.

  • Stateful – In stateful architecture let’s imagine a scenario of a eCommerce website that has 3 servers and there are 3 user connected to three servers and all the user session is store in the servers accordingly. Now let’s imagine a scenario of one of the three server goes down and all the state information about the users that were associated with it also lost. Now all that users have to do all the process again after establishing connection to a new server. So that’s a big issue in scalability and availability.
  • Stateless – In stateless architecture all the state information about the client is been stored in the shared storage connected to all the servers. Now let’s suppose a server goes down and and because all the state information is shared so if a client establish a connection with new server all the state information can be restored from the shared storage.

In conceptual we are going stateless but basically the we cannot eliminate the state entirely. There must be some place we are storing the states. We call it shared storage.

To be continued

Advertisement