I have a meteor app that's hosted on Galaxy with the database on mLab.
The meteor method to update documents works fine if the document is small, but if its larger than a certain size, the galaxy CPU usage goes up to 100% and the container becomes unhealthy.
Meteor APM reports that the database update is taking <400ms, while "computation" (directly prior to update) is taking 80 000+ ms.
Here's a simplified example of the code.
The collection is declared and assigned a schema in one file.
trips.js
const Trips = new Mongo.Collection('trips');
//schema is declared and attached
export {Trips}
The methods are declared in another file.
Methods.js
import {Trips} from '../trips';
Meteor.methods({
'updateTrip' (tripId, trip){
check(tripId, String);
check(trip, Object);
Trips.update({
_id: tripId
},{
$set: {
field1: trip.field1,
field2: trip.field2,
field3: trip.field3
}
});
}
});
In some cases the fields are objects with large objects nested within.
I'm new to Meteor and MongoDB, and was not the original developer for this project, so I'm wondering if there's a bug in this code that could be causing the 100% CPU usage and long delays.