I've got an app where it takes considerable time to process a list of
requests from a user, and so would like to use
periodically_call_remote
to update a page showing how many requests have been processed. The
relevant page uses javascript to hide the user submission form and
replace with an animated "please wait" gif whilst the process runs,
and
I'd also like it to display the count of requests processed. Here's a
summary of the code:
How many mongrels are you running. if the answer is 1 (eg in
development) then that's why. Rails won't process more than 1
concurrent request per mongrel.
Rails won't process more than 1
concurrent request per mongrel.
That's it, then.
Is there any way of running multiple mongrels in development?
Thanks.
Same way as you would in production (mongrel cluster behind
something (eg apache) proxying to it).
That won't solve your problem though: apache etc... will choose the
mongrel to proxy to round-robin style, so half of your requests will
be queued up behind this long running action. Long running actions
aren't a good idea for that reason (offload to backgroundrb or similar)
Long running actions
aren't a good idea for that reason (offload to backgroundrb or similar)
It looks like backgroundrb is the answer then.
All that's required is for the user to be notified when their data are
ready for collection and the site already does that by e-mail.
Thanks!
Backgroundrb worked nicely for that particular problem, but now another
has cropped up.
One particular page allows the user to search through the database to
find and select some data that will be processed by the really long
query that backgroundrb deals with. The sequence goes as follows:
1. User starts the search, browser displays animated gif and says
"please wait."
2. After two minutes the browser times out and displays a blank page.
3. After three minutes the mysql query finishes and is stored in the
mysql cache.
4. If the user tries the same query again the cached results appear in
seconds.
This is a bit of a nuisance. Does anyone have any suggestions for
dealing with this one?