Ruby 1.8′s Dismal Net/HTTP Performance
A 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 contact@richappsconsulting.com. Please visit our website at http://www.richappsconsulting.com.
October 5, 2008 at 4:55 pm
Great, more internet attitude. Yes, Adam, you're so transgressive; we get it.
October 5, 2008 at 5:43 pm
You know, the sheer quantity of advertising on this site makes me fucking miserable.
October 5, 2008 at 5:59 pm
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.
October 5, 2008 at 6:42 pm
Tom: Gotta eat.
October 6, 2008 at 2:44 am
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.
October 6, 2008 at 2:54 am
I might be wrong, but REE doesn't have a modified standard library, does it? If not, then it'd still be a problem.
October 6, 2008 at 9:55 am
PJ Davi, Peter Cooper: yeah the problem applies to REE as well.
October 7, 2008 at 1:36 am
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.