skokal01 / mongoose

Automatically exported from code.google.com/p/mongoose
0 stars 0 forks source link

The keep-alive feature is not exposed to the embedded handlers. #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The keep-alive feature is not exposed to the embedded handlers.

A small exposed function like the following would allow embedded handlers
to benefit from the keep-alive feature.

void
mg_set_keep_alive(struct mg_connection *conn, int keep_alive)
{
    conn->keep_alive = keep_alive;
}

Original issue reported on code.google.com by gilbert....@gmail.com on 24 Jun 2009 at 9:39

GoogleCodeExporter commented 9 years ago
I am about to kill keep alive, how will it affect you?

Original comment by valenok on 28 Jun 2009 at 8:56

GoogleCodeExporter commented 9 years ago
I thought that HTTP connections were supposed to be stateless. Doesn't 
keep-alive
violate this principle?

Original comment by googl...@springtimesoftware.com on 28 Jun 2009 at 4:38

GoogleCodeExporter commented 9 years ago
It does not. Keep-alive means that new HTTP request may be sent in the same TCP 
session (re-use of TCP connection). It does not mean it brings state to HTTP. 
New 
request may have nothing to do with the previous one. It is just a way to save 
for 
TCP expenses (TCP connection establishment, so called 3-way handshake and 4-way 
tear 
down).

In order to make keep-alive possible, both sides (client and server) should 
send a 
messages that fully specify message length, to make it possible to identify 
message 
boundaries in TCP stream. This is done either explicitly by setting 
Content-Length 
header, or implicitly (some responses always have no data, just headers).

Original comment by valenok on 28 Jun 2009 at 5:33

GoogleCodeExporter commented 9 years ago
Keep-alive is not a requirement.  However, it seem to not only provide not only 
a
resource savings with regard to TCP sockets, but a savings in threads.  It 
would be
unfortunate if the Content-Length is known and the browser client supports
keep-alive, to not support in on the server.

Is the keep-alive being removed because it is problematic, or because of some 
other
code change?

Original comment by gilbert....@gmail.com on 30 Jun 2009 at 5:12

GoogleCodeExporter commented 9 years ago
I have to admit that I cannot implement keep-alive in the manner it should be
implemented: simple and reliable. The reliability and simplicity has higher 
priority
for me then the performance, and so I am making a call to remove keep-alive 
support.

Thread pool support in Mongoose is broken currently: thread exits when request 
is
processed. It will be fixed shortly, and thread will wait for some time for 
another
connection.

Without keep-alive, we loose only on TCP housekeeping.

Original comment by valenok on 30 Jun 2009 at 5:51

GoogleCodeExporter commented 9 years ago
Keep-Alive support is gone.

Original comment by valenok on 5 Jul 2009 at 7:28