What does “stateless”mean?

 

Definition ” statelessness “What does”stateless” mean?

Statelessness is the property of protocols and applications to treat each interaction as an independent, self-contained process. In contrast, state-affected systems need to store session data.

Company about the topic

Requests to stateless systems are inherently complete and independent, so they can be easily delegated to other servers.Requests to stateless systems are inherently complete and independent, so they can be easily delegated to other servers.

(© sdecoret – stock.adobe.com)

Web applications, cloud systems and other client-server architectures can be either stateful or stateless. Choosing the right method is crucial, because both concepts have their advantages and disadvantages.

What is a state?

In computer science, the term “state” refers to the state, the specific conditions of a system or an object at a certain time. States describe the context in which a process or request is executed.

To complete a task, several work steps are often necessary. Each work step leads to a change in the state of the processing system. Depending on the state of the processing, other actions must be carried out in the further course.

A simple example should illustrate this:

A user wants to use an online image converter to convert a JPG file to PNG. The website requires a login, so that the user is initially in the “not logged in” state. It logs in, which changes its state to “logged in”.

The user has already used this Outstaffing service before and has adapted some presets to the desired compression parameters. Now it uploads the file, whereupon the converter converts the image depending on the specified options. Both the login status and the various parameters are examples of states.

Stateful and stateless protocols

The above example shows a state-affected sequence. With such systems, the individual processing steps depend on previous processes. State-affected processes, however, are not synonymous with state-affected protocols. The web protocol HTTP is basically stateless. Each request-response pair is self-contained and does not require any cached information. Nevertheless, web applications such as the described online converter can be built.

For state-based protocols, the server merges multiple requests into one session. It stores information about previous transactions – so-called session data. He accesses these during the further course of the session, so that they do not have to be transferred again. It is also possible to store information across multiple sessions.

A typical example of state-based protocols is FTP (File Transfer Protocol). If a client connects to an FTP server, the server opens a session that remains active until the end of the communication. During the session, the server remembers various information – including the transmission parameters and the current directory on the server.

For stateless protocols, however, the server does not store session data. Stateless means that every request is a completely new process that takes place completely independently of previous processes. Each request contains all the necessary data to be able to process the request. State-driven processes can be implemented at a higher level of communication, for example with URL parameters, cookies or POST data.

Statelessness and state liability in comparison

State-based web services require a more complex server infrastructure. You need storage systems and databases to store session data for the clients. Programming is also complicated.

For each request, the server must check whether the request is valid and meaningful in the context of the current session. In addition, he must regularly clean up incomplete or broken sessions. Stateful services are useful for small, simple systems that require little dynamic data.

Stateless systems are therefore easier to set up. They deliver high scalability through better load distribution. All requests are complete in themselves and independent of all previous operations, so they can be easily delegated to other servers. In addition, there is a higher fault tolerance. Non-matching requests, incomplete session data or connection cancellations are no problem.

(ID:46955029)

Ready to see us in action:

More To Explore

IWanta.tech
Logo
Enable registration in settings - general
Have any project in mind?

Contact us:

small_c_popup.png