I have to develop an API which does some map reduce jobs in the background and then return the results. Its a sinatra application with a Riak No-sql database. The issue is that the job takes around 5-10 minutes to run. And the request times out in that amount of time. What can be the best ways to run such kind of jobs in the background?
Asked
Active
Viewed 101 times
-1
-
2Is the data set large enough (data to be analyzed won't fit in RAM) that you really need MapReduce, or are you using that as a way to query for arbitrary data in Riak? It's far better to model your data appropriately for key/value than to rely on MapReduce for everything; as you note, MapReduce is better suited for batch jobs. – macintux Dec 19 '13 at 19:07
2 Answers
1
Something like DelayedJob with a layer of something like Redis over the top (to keep track of job state), that is accessed by a unique route (your Sinatra API). Then have a different page (the web page for browser clients) that calls the API via AJAX, polling it periodically.

ian
- 12,003
- 9
- 51
- 107