# Net::HTTP Performance

**URL:** <https://www.ruby-forum.com/t/net-http-performance/98653>\
**Category:** Ruby\
**Created:** [July 17, 2006, 10:02am UTC](https://www.ruby-forum.com/t/net-http-performance/98653 "2006-07-17T10:02:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [July 17, 2006, 10:02am UTC](https://www.ruby-forum.com/t/net-http-performance/98653/1 "2006-07-17T10:02:20Z")

</div>

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: removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [July 17, 2006, 10:20am UTC](https://www.ruby-forum.com/t/net-http-performance/98653/2 "2006-07-17T10:20:38Z")

</div>

Ben J. wrote:

> Thanks for your help.
> 
> Thank You,  
> Ben J.  
> E: removed\_email\_address@domain.invalid

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](http://ola-bini.blogspot.com))  
JvYAML, RbYAML, JRuby and Jatha contributor  
System Developer, Karolinska Institutet ([http://www.ki.se](http://www.ki.se))  
OLogix Consulting ([http://www.ologix.com](http://www.ologix.com))

“Yields falsehood when quined” yields falsehood when quined.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [July 17, 2006, 10:51am UTC](https://www.ruby-forum.com/t/net-http-performance/98653/3 "2006-07-17T10:51:28Z")

</div>

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](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](http://groups.google.com/groups/search?q=net%3A%3Ahttp+performance+ruby)

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [July 17, 2006, 10:42am UTC](https://www.ruby-forum.com/t/net-http-performance/98653/4 "2006-07-17T10:42:11Z")

</div>

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.
