Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between stateless and stateful systems, and how do they impact parallelism?

Explain the differences between stateless and stateful systems, and impacts of state on parallelism.

like image 518
Stack Guru Avatar asked Mar 25 '11 17:03

Stack Guru


People also ask

What is the difference between stateless and stateful systems How does this impact scaling?

Stateful services keep track of sessions or transactions and react differently to the same inputs based on that history. Stateless services rely on clients to maintain sessions and center around operations that manipulate resources, rather than the state.

What is the difference between stateful and stateless?

Stateless Protocol is a network protocol in which Client send request to the server and server response back as per the given state. Stateful Protocol is a network protocol in which if client send a request to the server then it expects some kind of response, in case of no response then it resend the request.

What are the differences between a stateful and stateless connection give examples?

In stateless protocol, server is not restricted to keep the server information or session details. In stateful protocol, server is not restricted to keep the server information or session details. 5. Examples of the stateless protocol are UDP (User Datagram Protocol), HTTP (Hypertext Transfer Protocol), etc.

What are stateful systems?

In stateful, the server is required keep information about the current state and session. It is easy to scale the architecture. It is not easy to scale the architecture. The server and client are independent i.e., loosely coupled. In stateful, server and client are not independent i.e., tightly bound.


1 Answers

A stateless system can be seen as a box [black? ;)] where at any point in time the value of the output(s) depends only on the value of the input(s) [after a certain processing time]

A stateful system instead can be seen as a box where at any point in time the value of the output(s) depends on the value of the input(s) and of an internal state, so basicaly a stateful system is like a state machine with "memory" as the same set of input(s) value can generate different output(s) depending on the previous input(s) received by the system.

From the parallel programming point of view, a stateless system, if properly implemented, can be executed by multiple threads/tasks at the same time without any concurrency issue [as an example think of a reentrant function] A stateful system will requires that multiple threads of execution access and update the internal state of the system in an exclusive way, hence there will be a need for a serialization [synchronization] point.

like image 185
sergico Avatar answered Oct 06 '22 00:10

sergico