[Haskell-cafe] a tiny HTTP server.. that doesn't work

Corey O'Connor coreyoconnor at gmail.com
Wed Nov 6 02:10:27 UTC 2013


I've updated the code to handle persistent connections. As best I can
figure anyways..
Unfortunately this does not resolve the issue. The server still reports the
connection being closed before the full response is read.

The test is done via JMeter. See the perf_test.jmx file. I've confirmed
JMeter is include "connection: close" headers in all requests. Which means
the persistent connection code is not even being exercised. From
instrumenting the code I can confirm this is the case: All requests include
"connection: close" and the client never performs a second request using
the same stream.

An additional data point: The same test when run with 1 capability (EG:
+RTS -N1) does *not* fail. There are no connection close errors. Only when
running with multiple capabilities does the test fail.

Cheers,
Corey


-Corey O'Connor
coreyoconnor at gmail.com
http://corebotllc.com/


On Tue, Oct 22, 2013 at 4:54 PM, Corey O'Connor <coreyoconnor at gmail.com>wrote:

> On Mon, Oct 21, 2013 at 7:28 PM, Joey Adams <joeyadams3.14159 at gmail.com>wrote:
>
>>  On Mon, Oct 21, 2013 at 5:15 PM, Corey O'Connor <coreyoconnor at gmail.com>wrote:
>>
>>> Curiously: If the Network.HTTP.close is removed the server does not
>>> fail, but some requests takes several seconds to process. I presume the
>>> ordering of effects is then correct, but without the explicit close the
>>> close occurs only a GC time.
>>>
>>
>> The client may be trying to reuse the connection; see
>> http://en.wikipedia.org/wiki/HTTP_persistent_connection.  This seems
>> consistent with your results:
>>
>>  * With the close call: connection is closed right after client sends a
>> second request, so client whines.
>>  * Without the close call: client waits around for a response, then gives
>> up and establishes another connection.
>>
>> To confirm, add another receiveHTTP call client_interact and see if it
>> returns another Request.
>>
>
> ​Thanks!​ I'll try your test and see if anything changes.
>
> Though I thought the code accounted for this: A connection close header is
> added to each response. Which I thought would cause the client to close the
> connection.​​ I could be totally wrong tho. There could be some additional
> aspect of HTTP connections I do not understand.
>
> Properly supporting persistent connections should be pretty easy. There is
> another Network.HTTP server package that does this:
> http://hackage.haskell.org/package/http-server-1/docs/Network-HTTP-Server.html
>
> So I'll give that a shot and report back.
>
> Thanks!
> Corey
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131105/b49c1802/attachment.html>


More information about the Haskell-Cafe mailing list