How can I check if meteor is using the oplog of my mongo? I have a cluster of mongo and set two envs for my meteor.
MONGO_URL=mongodb://mongo/app?replicaSet=rs0
MONGO_OPLOG_URL=mongodb://mongo/local?authSource=app
How can I check if the opt log is actually in use. Meteor can fallback to query polling which is very inefficient but I would like to see if it's working properly with the oplog.
Any ideas?
Quoting the relevant bits from Meteor's OplogObserveDriver
docs:
How to tell if your queries are using OplogObserveDriver
For now, we only have a crude way to tell how many observeChanges calls are using OplogObserveDriver, and not which calls they are.
This uses the
facts
package, an internal Meteor package that exposes real-time metrics for the current Meteor server. In your app, runmeteor add facts
, and add the{{> serverFacts}}
template to your app. If you are using theautopublish
package, Meteor will automatically publish all metrics to all users. If you are not usingautopublish
, you will have to tell Meteor which users can see your metrics by callingFacts.setUserIdFilter
in server code; for example:
Facts.setUserIdFilter(function (userId) {
var user = Meteor.users.findOne(userId);
return user && user.admin;
});
(When running your app locally,
Facts.setUserIdFilter(function () { return true; });
may be good enough!)Now look at your app. The facts template will render a variety of metrics; the ones we're looking for are observe-drivers-oplog and observe-drivers-polling in the mongo-livedata section. If observe-drivers-polling is zero or not rendered at all, then all of your observeChanges calls are using OplogObserveDriver!