Typhoeus: A High Speed, Parallel HTTP Library for Ruby
Paul Dix, of Feedzirra fame, strikes again! This time with Typhoeus (Github repo), a high-speed, parallel HTTP request library for Ruby. At first glance, you could be forgiven for wondering what the point is when we already have John Nunemaker's awesome HTTParty to build simple HTTP clients, but Typhoeus is, in many ways, like HTTParty on ten cans of Red Bull.
Typhoeus was built because Paul wanted to make numerous simultaneous HTTP requests at a time from his Ruby code. He didn't want any blocking and the whole setup had to be as fast as possible. To do this, he's interfaced with libcurl and libcurl-multi to pull off high speed concurrent HTTP requests and then laid a tidy Ruby API over the top.
Paul has some example code for you to check out, and while it's a little more verbose than HTTParty, the benefits available to you if you need to do high speed, concurrent requests make this a must-have for your Ruby repertoire. An interesting part of Paul's approach is that Typhoeus uses lazy evaluation to pull off the concurrency. When you build a request, the request isn't performed right away, as it would be with, say, Net::HTTP or HTTParty. Instead, a proxy object is maintained that then triggers the request at the very point that data is demanded from the client app.
Installation instructions, potential snafus, and usage information is covered on the official Github repo page.
Note: Paul plans to update Feedzirra to using Typhoeus in due course, but currently they use totally different HTTP request techniques.