Net::HTTP Performance

I know there was already another thread on this, but I didn’t
completely understand. I would love to re-read it but I accidentally
deleted the emails. I remember something about changing a buffer size.

Can anyone please send me that thread or basically tell me what the
fix was, because I could desperately use it.

Also, I’m not 100% sure this fix would apply to my situation, but
basically I’m going out to a website and retrieving the HTML. Is that
fix applicable here and would it improve speed?

Thanks for your help.

Thank You,
Ben J.
E: [email protected]

Ben J. wrote:

Thanks for your help.

Thank You,
Ben J.
E: [email protected]

Yes, and yes. The fix is basically to go into your
$RUBY_HOME/lib/ruby/1.8/net/protocol.rb, find the method called
rbuf_fill and change the sysread to something bigger than 1024. Probably
8192 or 16384 would be good enough for your purposes.


Ola B. (http://ola-bini.blogspot.com)
JvYAML, RbYAML, JRuby and Jatha contributor
System Developer, Karolinska Institutet (http://www.ki.se)
OLogix Consulting (http://www.ologix.com)

“Yields falsehood when quined” yields falsehood when quined.

On Jul 17, 2006, at 1:01 AM, Ben J. wrote:

I know there was already another thread on this, but I didn’t
completely understand. I would love to re-read it but I
accidentally deleted the emails.

Its in the archives:

http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml

And a google search works too:

http://groups.google.com/groups/search?q=net%3A%3Ahttp+performance+ruby


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Ola B. wrote:

Yes, and yes. The fix is basically to go into your
$RUBY_HOME/lib/ruby/1.8/net/protocol.rb, find the method called
rbuf_fill and change the sysread to something bigger than 1024.
Probably 8192 or 16384 would be good enough for your purposes.

Ruby being Ruby, you can also just reopen the class and redefine the
method in question to your liking:

class ::Net::BufferedIO
def rbuf_fill
timeout(@read_timeout) {
@rbuf << @io.sysread(8192)
}
end
end

But it’s probably not a good idea to release code like this in a library
to the public.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs