Introduction to Stateful and Stateless ( I )

Introduction to Stateful and Stateless ( I )

State: the particular condition that someone or something is in at a specific time.      –

At first, take credit card customer service in a bank as an example. You might have some experience that the customer service help you transfer your call to different departments. If you are not satisfied with your credit limit and you want to increase the credit line, the customer service will ask you a lot of personal information such as birth date, current address, and phone number when you call the bank. After this authentication procedure, the customer service can start asking your requirements. If the customer service cannot handle your credit line increase, your call will be transferred to the correct department that can solve this problem. It has a high possibility that you need to do the authentication procedure again after the transferring. It is an annoying process but you still need to do it reluctantly.

Back to the “State”, in computer science, it means a reachable information in a specific time. In other words, it is information storage. The above example illustrates the inconvenience of duplicating authentication. Now comes to load balancing (se Fig.1.) Assume an user sends a log-in request to a website from the web browser, the load balancer (LB) of the website will transfer the request to Server 1 based on its algorithm (ex: Round Robin here.) Server 1 will response log-in success after checking with the database.

Figure 1: Traditional load balancing

If the user wants to change his/her address and sends an update request, the request will be sent to LB again. LB will transfer this request to Server 2 based on the Round Robin algorithm. However, Server 2 does not have the log-in information of the user that sent to Server 1. That is to say, Server 2 does not have the user state so it will ask the user log-in again. This is quite similar to the credit line increase case. These examples are the condition without stateless. If you are the user, this is not only annoying but inefficient.

To solve stateful problems, we can make use of sticky session, stateless, …, or other approaches. To investigate if these approaches are effective, please follow our next article “ Introduction to Stateful Application and the Solutions.” We will provide further information in it.

By: 賴欣宜 迎棧科技技術專欄作家


Select list(s)*