From: Brian Candler Date: 2003-03-12T09:12:29+09:00 Subject: Re: Net::HTTP optimisation (was: Suggestion for setsockopt) On Tue, Mar 11, 2003 at 08:02:26PM +0900, Minero Aoki wrote: > > However it seems that the underlying problem is that the Net::HTTP library > > sends its request as multiple writes (one for the GET or POST line, one for > > each header line, one for the blank line, and one for any POST content if > > included) > > > > Coalescing these into a single write is straightforward, so I'd like to > > propose that at least GET requests be fixed as follows: > > Agreed. I have commit your suggestion. > Thank you. You are welcome! Although this makes the packet go out with zero delay under Solaris (2.8), I discovered today that under FreeBSD (4.7) I still get the 0.1 second delay, unless I also setsockopt TCP_NODELAY. Presumably its Nagling algorithm is different. Do you think it's worth setting this option in Net::HTTP conditionally if the platform supports it? (Maybe just in Net::HTTP#start?) If someone tries to do a loop of HTTP requests and only sees 10 per second, they may think "this darn Ruby scripting language is far too slow" when actually it's not Ruby's fault at all... Regards, Brian.