State?

  • Information or data that is stored and maintained by a system
  • ex) Session data, Authentication tokens, etc

Stateful

  • The server or the system keeps track of the state (context) of each client session
  • Maintains information about the past interactions with the client and uses this information to process subsequent requests
  • ex) Server might store and manage state for each client, such as user preferences, authentication status, and more

Stateless

  • The server does not keep track of the state of each client session
  • Each request is treated independently, and the server does not store any session data or client state
  • The server processes each request based solely on the information contained within the request
  • No need to maintain any client-related data

Differences between Stateful and Stateless

  Stateful Stateless
Definition    
Examples TCP, FTP, Telnet HTTP, UDP, DNS
Server? Need server to store session and maintain the server Can be serverless
Resources Generally requires more resources Requires less resources 
Crash? Needs to restore the state stored Works better as there is no state that needs to be restored - we can simply restart a server or move to another server
Same server? The same server must be used to maintain and remember the state Different servers can be used to handle different information
Implementation Relatively harder to implement on the Internet Relatively easier to implement on the Internet
Transaction Can handle quickly on the server Relatively slower on the server

 

+ Recent posts