Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Ruby 1.8′s Dismal Net/HTTP Performance

By Peter Cooper / October 5, 2008

htperfruby18.pngA week ago, Adam Nelson (a Virginia-based Ruby developer) complained about Ruby's "absolutely bullshit Ruby HTTP client situation." He was running into a nasty situation where Ruby's standard HTTP client library (net/http) was sending data in 1 kilobyte chunks, causing his CPU to redline. Due to net/http's popularity (particularly with other libraries), Adam saw this as a big issue.

Today, Adam returns with a more scientific analysis of Ruby 1.8.x's HTTP client performance. He discovers that while Ruby 1.8.6 and below have a hard-coded 1KB buffer size for HTTP reads, Ruby 1.8.7 extends the buffer to 16KB.

The results are very interesting and worth checking out, and while Adam's his ultimate conclusion is that "Ruby's Net::HTTP implementation blows," he's looking to work on the necessary changes to bring net/http up to speed. If you want to help out or give advice, leave comments on Adam's post.

Post supported by RichAppsConsulting: Are you looking for an Agile web 2.0 company to develop your company's website quickly and professionally? At RAC, we have a highly trained staff of developers who are experts in Rails, Flex and PHP development. We can develop solutions for your company with your budget and timeline in mind. We pride ourselves on having superior Rails programming skills the and striving for continuous improvement. For more information, call our office at 202.470.6683 or email us at Please visit our website at


  1. Jackson says:

    trollGreat, more internet attitude. Yes, Adam, you're so transgressive; we get it.

  2. Tom says:

    trollYou know, the sheer quantity of advertising on this site makes me fucking miserable.

  3. Ben Johnson says:

    Awesome! The Net::HTTP library for ruby does blow, which is why I always resort to using cURL. I know it's not the most elegant solution, but cURL is extremely fast and well tested. It has all of the options anyone would need. With the benchmarking I did using cURL in my ruby app was MUCH faster than Net::HTTP or any alternative ruby library.

  4. Peter Cooper says:

    Tom: Gotta eat.

  5. PJ Davi says:

    Do you know if this is also a problem with Ruby Enterprise Edition (by Phusion, the Passenger guys)? I would have asked Adam Nelson himself, but I didn't see anywhere to comment on his blog.

  6. Peter Cooper says:

    I might be wrong, but REE doesn't have a modified standard library, does it? If not, then it'd still be a problem.

  7. Hongli Lai says:

    PJ Davi, Peter Cooper: yeah the problem applies to REE as well.

  8. Dudeman says:

    This guy is hilarious. This blog has to be a joke. Seriously, look around. So funny. Cat pictures, talk about how he carries a gun in his car, and hate for everything. Lol.

Other Posts to Enjoy

Twitter Mentions