rainbows for 3rd party api

Giovanni Lion giovanni.lion at gmail.com
Wed Nov 4 13:49:33 EST 2009

Hi all,

I came across rainbows while I was looking for a smart solution for
handling 3rd party api calls for my rails app. I would like to know a
little more about how to achieve efficency in the following context:

1 user requests a page
2 page content requires xml to be retrieved from 3rd party server
through http call
3 page is rendered, without the 3rd party data but with an onload ajax
request back to the app to retrieve 3rd party data
4 app generates an http call to 3rd party api
5 app waits for 3rd party response
6 app responds to ajax call rendering html out of the xml response
from 3rd party api

Right now my current setup is apache + passenger, no constraints on
switching to anything else. This setup is not optimal of course
because if i receive many concurrent requests that need 3rd party
response passenger app pool is full and sleepy. From what i read in
the documentation rainbows should come handy in this situation. I had
a look at unicorn and i think i got more or less how it works. Can
anyone suggest me how to set up the app deployment in order to reduce
waste on step 5? My guessing is should create a rack app to handle
these calls using DevFdResponse and run it with rainbows. Only problem
is can i have the rails environment in there?

Thanks in advance,


More information about the rainbows-talk mailing list