[Mongrel] recv vs. read in HTTPRequest#read_socket

Erik Hetzner erik.hetzner at ucop.edu
Wed Feb 28 17:47:49 EST 2007


At Mon, 05 Feb 2007 14:16:44 -0800,
Erik Hetzner wrote:
> Hello all,
>
> The following change to Mongrel::HttpRequest:

[…]

> seems to work for me, and vastly improves the speed of the body
> processing (quick tests reveal that using IO#read takes about 1 min 40
> secs. and using Socket#recv takes about 9 secs on an 8.5 mb file). I
> have been having trouble discovering the difference between read &
> recv (I am not a socket developer by any means). Can anybody tell me
> what sort of safety one loses by doing this with recv instead of read?
> Thanks.

As a followup, in case it wasn’t obvious, I was far off base here. I
should have realized that something was wrong with such horrible
transfer speeds. While it still seems using recv instead of read, and,
conversely, send instead of write gives you a very slight speedup,
most of my problem here was a runaway while loop in another thread
(while true do; end seems to take up a lot of time).

best,
Erik Hetzner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20070228/72da5664/attachment.bin 


More information about the Mongrel-users mailing list