Explain the differences between stateless and stateful systems, and impacts of state on parallelism.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With