Professional Documents
Culture Documents
Stateful
- connection is maintained from beginning to the end of call to ensure continuous communication.
- connection is validated first, then session will be established indefinitely, until end of talk
- If client deliver a request to server in stateful protocol, it expect a response of some sort
Feature: it maintains the state of all its sessions, be in an authentication session, or client request for
information
- context of prior transaction in which the state is stored. Previous transaction will have impact on
current transaction
Advantages
2. Keep track of the connection information, as a result, deliver superior performance because they
continue keeping track of information
3. More intuitive because they maintain data on server between two requests
Disadvantages
5. If there is inefficient maintenance of session storage, there can be decrease in the performance
Stateless
- No confirmation from the receiving device to the sending device that message has been received
- Once transaction is completed, connection between the browser and the server is also terminated
Advantages
1. Each individual communication is unconnected and distinct from the ones that come before or
after it
2. Since monitoring system does not have to look beyond a single request to determine its whole
nature, visibility of the protocol is improved
3. Each packet of data travel on its own, no need to refer to another packet
4. Server does not have to store session state between requests; hence, scalability is enhanced as
deploying the services to any number of servers is possible, implementation is simplified even more
5. Easy to recover from partial failures like crashes since no state is maintained, which improved
reliability
Disadvantages
1. Less capable as they do not store any information about a particular user session
2. May be essential to include additional information in each request, as a result, server will need to
interpret this new information every time it received
3. May degrade network performance by increasing the amount of repetitive data delivery tasks in a
series of requests, which cannot be saved and reused.
Stateful Stateless
Require the server to save the state of a No server needed
process
Require a server to store and save status No server needed
information and details of sessions
Server and clients are tightly coupled, and are Server and clients are more independent and
extremely interdependent on each other hence, loosely coupled
Logically heavy to implement Easier to implement
React only by the current state of a transaction Act independently by taking the previous or
or request next request into consideration
Expect a response, if no answer is received, the Client send request to server, which the server
request is resent responds to based on the state of the request
Scaling architecture is difficult and more Easier to scale architecture
complex
Difficult to code as one of the salient features Much easier to code
here is data storage
Example: Telnet & FTP (File Transfer Protocol) Example: HTTP, UDP (User Datagram Protocol),
DNS (Domain Name System), REST APIs
Is stateless better than stateful?
Stateless better when: you only require information in a transient, rapid and temporary manner
Stateful better when: your app requires more memory of what happened from one session to the
next