rails 2 and slow external services

Eric Wong normalperson at yhbt.net
Mon Dec 13 05:39:36 EST 2010

ghazel at gmail.com wrote:
> Hi,
> Some of my page loads (currently serviced by Unicorn) spend a great
> deal of time waiting for external services (OpenID, OAuth, etc over
> Net::HTTP and curb), so I'm looking at Rainbows!. I use Rails 2.3.10.
> Which concurrency model in Rainbows! is best suited for this sort of
> page? I'm not totally clear on which parts if any of Rails are
> thread-safe.

Hi, if you want compatibility over the greatest number of existing Gems,
then ThreadSpawn and ThreadPool are the safest options.

I'm fairly certain Rails 2.3 (or even 2.2) are _advertised_ as
thread-safe but I've never tested it heavily.  Hopefully other folks can
give some feedback here.

If you're running Ruby 1.9, then RevThreadSpawn and RevThreadPool should
be good options if you do heavy keepalive, too, but they're a bit iffy
under 1.8 due to incompatibilities with libev and the MRI 1.8 threading

Eric Wong

More information about the rainbows-talk mailing list