I am very interested in off-loading tasks from the request/response
cycle in order to speed up my application. My application is heavily
connected to using web services both external and from other servers we
My application does the following long-running tasks:
- accesses / pushes to the twitter api’s (with possible need for status
- accesses / pushes the facebook api’s (with need for status responses)
- requesting data from another server we run (rails needs access data)
- pushes information to aim using ruburple
I am just curious and grateful for any help people can give for what
would suit me best. I am familar with backgroundrb and bj along with
starling, etc. I don’t know which one will suit me best based on the
tasks I need to queue.
My main concern is how to properly request data and then show it to the
user. For instance, when the user logs into the rails application, I
need to show them certain information about them which comes from
complex analyzing of data done by another server we run.
When a user logs in, I need to show them the current results of this
analysis. To do this, I need to perform a GET request to another server
and get the results and then show them to the user. What is the “best
practice” way to achieve this in which I can offload this task to a
background worker and then get the results and display them to the user.
For instance, say the user logs in and then the background worker kicks
off to retrieve their current analyzed data from the server. How do I
then wait for the data to be retrieved by the worker and when it’s ready
display it to the user?
I feel like I am missing something because I don’t see how the worker
can “tell” the main rails application that it now has the data and then
somehow show it when its “ready”. Do I need to constantly poll the
server or how is this usually done.
Also, I need to allow the user to make certain changes to data fields
and then I need to push those changes to twitter and facebook via a
What solution is best suited based on what I described and could someone
please help me understand the pattern for how to do this. I will be