Monday, 8 August 2016

Stateless protocol

No client state on the server.
A stateless protocol does not require the server to retain session information or status about each communications partner for the duration of multiple requests.

The session is stored on the client. Server does not store any state about the client session on the server side.

Stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of request and response.

Examples
Stateless protocols include the Internet Protocol (IP) which is the foundation for the Internet, and the Hypertext Transfer Protocol (HTTP) which is the foundation of data communication for the World Wide Web.

HTTP is a Stateless protocol, meaning that each request message can be understood in isolation. Contrast this with a traditional FTP server that conducts an interactive session with the user. During the session, a user is provided a means to be authenticated and set various variables (working directory, transfer mode), all stored on the server as part of the user's state.

Advantages:
For a service which is used by 10's of thousands of concurrent users, We should make our service stateless.

It is an overall simpler implementation and you have a single code path instead of a bunch of server side logic to maintain a bunch of session state.

The stateless design simplifies the server design because there is no need to dynamically allocate storage to deal with conversations in progress.

If a client dies in mid-transaction, no part of the system needs to be responsible for cleaning up the present state of the server.

Disadvantage:
A disadvantage of statelessness is that it may be necessary to include additional information in every request, and this extra information will need to be interpreted by the server.

Stateful protocol
In contrast, a protocol which requires keeping of the internal state on the server is known as a stateful protocol.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...