Several of my meteor methods have mysteriously slowed down lately. While they were pretty fast, many of them took 10 or so seconds.
Things not causing slowdown:
- Additional functionality, slow sections of the code base have not been significantly changed
- Machine load (CPU load is about 30%)
- Additional database loading (no new queries added)
- return data transfer time (returns undefined)
- lock method (I tried with this.unblock () inside the method)
I debugged using console.time () / console.timeEnd () both on the server and on the client side. The server code takes about 0.3 seconds to start, but the client does not receive a callback about 11 seconds after meteor.call () ...
This is the server method:
function cancelSomething(somethingId, reason) {
console.time('cancelSomething method');
check(somethingId, String);
check(reason, String);
if (!AuthChecks()))
throw new Meteor.Error(401, 'Not Authorized');
var something = MySomethings.findOne({'_id': somethingId});
if (!something)
throw new Meteor.Error(404, 'Something not found');
var returnVal = SomethingService.cancel(something, reason);
console.timeEnd('cancelSomething method');
return returnVal;
}
on the client side:
console.time('meteorCall');
Meteor.call('cancelSomething', this._id, reason, function(err) {
if (err) {
console.log('an error occurred', err);
}
console.timeEnd('meteorCall');
});
EDIT: I noticed that there is some correlation with the number of documents in "somethings" in db. with 500 documents it takes about 1 second to receive a return to the client, with 5000 it takes about 8.5 seconds ...
source
share