A stateful server retains client information (state) between requests. The problem is that the same server must receive all requests coming from the same client. Most load balancers include sticky sessions that may be used for this. But this increases the overhead. This method makes it considerably more difficult to add or remove servers. In addition, managing server failures is difficult.
When a user signs in to a stateless system, a token is returned to the client. The client’s storage is where this token is kept. Then, each request the user makes includes this token. We cross-reference the token supplied with the request with the information kept in the database to confirm that the request is coming from an authorised user. We can quickly restore if the server is unavailable because the token is kept in the client’s storage.
The ideal strategy is to utilise NoSQL because horizontal scalability is more simpler in stateless architecture than with relational databases, Memcached/Redis, or NoSQL, is your databases.
Thanks for reading. If you loved this article, feel free to hit that follow button so we can stay in touch.
This article is possible because of these references. some external links in this post are affiliate.