0

Some said that HTTP has no concept of session because HTTP is stateless. Is it true? Why is that?

Thanks.

Tim
  • 1
  • 141
  • 372
  • 590
  • 2
    Possible duplicate of [Why say that HTTP is a stateless protocol?](http://stackoverflow.com/questions/13200152/why-say-that-http-is-a-stateless-protocol) – OneCricketeer Jul 26 '16 at 17:38
  • Who said that? If you don't believe it, why do you care? – Scott Hunter Jul 26 '16 at 17:40
  • This is an obvious duplicate of the above question. – sethmlarson Jul 26 '16 at 17:50
  • It is not a duplicate, the question about "Why say that HTTP is stateless protocol?" is about how statelessness of HTTP manifests itself and is answered as such. This question is about why is it stateless in the first place? – Jitendra Kulkarni Jul 26 '16 at 17:53

1 Answers1

1

This is a design decision made during HTTP design. The motivation seems to be scalability and response time. If a web-server were to serve 100million concurrent users and each of them were to store 100bytes of state information, that would be 10GB of information that needs to be consulted real (read RAM ) time and processed before a response is given. This was a major challenge when the protocol was designed. In addition to this issue that would surface when the HTTP is actively serving users, keeping state information would create large demand in setting up a new request (assign space, bind to the session etc.) and error handling (such as user closing his browser in the middle) and so on. As an example, TCP (over which HTTP runs) has a session concept. While designing solutions to accelerate TCP, it was found that setting up, tearing down and error handling was the hardest part to accelerate where as it was easier to accelerate the actual data transfer.

That said, cookies store information on the client side and create an impression of a session.