This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why http stateless?

 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

why http is stateless protocol.......
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A stateless protocol is more efficient than a stateful protocol. In a stateful protocol, (like TCP/FTP) the "connection" has to be open to keep the state. Each open connection costs resources on the server. Remember, that HTTP was really designed to serve up static files very efficiently. Having dynamic pages that are computer generated is something that was bolted on to HTTP. Dynamic pages require state, static pages don't.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's stateless because there is no information stored in the HTTP server from one request to the next. That's simply the definition of "stateless".
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i know.....i asked why http is stateless why not stateful ...we can also convert from stateless to stateful(session tracking)..

what's reason ....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayesh and Paul already answered your question. What more are you looking for?
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To tell the truth, I only guessed at the question because I didn't really understand what it meant.

Here's an analogy. Question: "Why do we wear shoes on our feet?"

There's nothing wrong with the question in terms of grammar, but what is it asking about? It might be asking "Why do we wear shoes on our feet instead of on our hands?" Or it might be asking "Why do we wear shoes, and not glasses, on our feet?" Or it might be asking "Why do we wear shoes on our feet instead of nothing?" Sure, you might say that some of those interpretations are ridiculous because we all know what shoes and feet are. But when you translate it to a context where we're talking about protocols and state, where the person asking the question might not know what those things are, all of the possible meanings come into play, no matter how ridiculous they may seem to somebody who does know what they are.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's another possible answer: HTTP is a stateless protocol because the designers of HTTP decided it should be one.
 
gurpeet singh
Ranch Hand
Posts: 924
1
Fedora Java Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayesh A Lalwani wrote:A stateless protocol is more efficient than a stateful protocol. In a stateful protocol, (like TCP/FTP) the "connection" has to be open to keep the state. Each open connection costs resources on the server. Remember, that HTTP was really designed to serve up static files very efficiently. Having dynamic pages that are computer generated is something that was bolted on to HTTP. Dynamic pages require state, static pages don't.


i see that you are saying that STATEFUL PROTOCOL , THE CONNECTION HAS TO BE OPEN. so that means in stateless protocol like http connection IS NOT KEPT OPEN. but i have read that in http 1.1 we have something called PERSISTENT CONNECTIONS, which keeps the connection alive. so is http statefull ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic