mapreduce - Node server is not responding to the Http requests made while MongoDb Map Reduce job is in process -


i developing application in mean stack. there heavy calculation required in application done using map reduce in mongodb.
map reduce takes 20 sec calculation.
if other user sends http request node server, gets stuck till mr completes.
question is. blocking server responding?

  1. is because of node thread busy during mr operation?
  2. does mongoose performing job during mr?

here code

var mapfunction = function() {          var key = this.id;         emit(key, 1);     };      var reducefunction = function(key, values) {         return values*5;     };      var finalizefunction = function (key, reducedval) {        var calcdata;          calcdata = calculationfn(reducedval);          return calcsdata ;     };      motors.mapreduce({         map: mapfunction,         reduce: reducefunction,         finalize: finalizefunction,         out : {replace : "search_results"}         //out: { inline: 1 }      }, function (err, results) {         var output = [];         console.log("done search");         next(undefined, output);     }); 


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -