A little confused with the notion of stateful/stateless architectures. Forgive me if I'm unclear.

Questions: Can we consider a clients interaction with a web server to be stateful if the web server maintains state via session variables or cookies? What if we assume that any change to this information comes from the client side any way and doesn't depend on other users?

  • What about amazon's web store? Although state may change and not be reflected automatically to the client... if the client attempts to operate on stale data, the system recognizes this and acts appropriately. Is this purely stateless still? Or somewhere in between?

  • What if we added a layer of java script that constantly polled the server every second to keep the client side updated? At an abstract level wouldn't this be considered stateful because the client will continuously have an updated state?

Definitions/Models I'm trying to work with:

Stateless architecture of websites: HTTP is a stateless protocol. The client makes an HTTP web request. The server calculates/processes the request and returns back to the client the appropriate information which the current state of the website. While the client has that information, the website can change state and these changes won't be reflected back to the client side until the client makes another web request.

Stateful architecture: The client can simply operate assuming that any data that is seen represents the actual state of the server.

  • Cookies are client-side, yes, but sessions are server-side. Although they are entirely dependent on the client (unless the server is shut down which shouldn't happen very often), so there's that.
    – trysis
    Sep 18, 2014 at 14:52

1 Answer 1


HTTP is a stateless protocol in that each request is an independent transaction. What came previously or what is expected to come next has no effect on an individual request.

However, this doesn't mean everything you do on the internet is stateless. Sites like Amazon store states, obviously. They remember what you have done in the past and know what you are in the middle of doing. The shopping cart remembers what items you have added across many individual HTTP requests.

Websites get around the stateless nature of HTTP protocol by doing two basic things:

  • Storing the state of each user on the server, such as your shopping cart, your profile, and the history of what you have purchased.
  • A method of identifying the same user across multiple requests, such cookies stored on the client side, IP address, and state information embedded in the source of a web page that was served. In practice, multiple methods of identification are often used together.

Even though each request is independent from the point of the view of the protocol, the application of these methods gives a context to each page that is served to you. The stateless is made stateful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.