- A stateful server remembers client data (state) from one request to the next.
- A stateless server keeps no state information
- Using a stateless file server, the client must
specify complete file names in each request
specify location for reading or writing
re-authenticate for each request
- Using a stateful file server, the client can send less data with each request
- A stateful server is simpler
- On the other hand a stateless server is more robust
lost connections can’t leave a file in an invalid state
rebooting the server does not lose state information
rebooting the client does not confuse a stateless server
Stateful Versus Stateless Servers
The file servers that implement a distributed file service can be stateless or Stateful. Stateless file servers do not store any session state. This means that every client request is treated independently, and not as a part of a new or existing session. Stateful servers, on the other hand, do store session state. They may, therefore, keep track of which clients have opened which files, current read and write pointers for files, which files have been locked by which clients, etc.
The main advantage of stateless servers is that they can easily recover from failure. Because there is no state that must be restored, a failed server can simply restart after a crash and immediately provide services to clients as though nothing happened. Furthermore, if clients crash the server is not stuck with abandoned opened or locked files. Another benefit is that the server implementation remains simple because it does not have to implement the state accounting associated with opening, closing, and locking of files.
The main advantage of Stateful servers, on the other hand, is that they can provide better performance for clients. Because clients do not have to provide full file information every time they perform an operation, the size of messages to and from the server can be significantly decreased. Likewise the server can make use of knowledge of access patterns to perform read-ahead and do other optimizations. Stateful servers can also offer clients extra services such as file locking, and remember read and write positions.
Another good website to read: